https://github.com/qbicsoftware/etl-scripts/blob/c9b8cf40b701673112e5fe6051a63397fcc2f24c/drop-boxes/register-omero-metadata/backendinterface.py#L147 This code is also used in two different methods. It might makes sense to write a new method to do this.