We should create a utils function for that like that : https://github.com/slok/circus/blob/fd4a97ee2f8333b64dd255a7dd0cca39e194d9b6/circus/util.py#L610