'Inspect a ``docker.errors.APIError`` to determine if it represents a
failure to start a container because the container is configured to use
ports that are already in use on the system.
:return: If this is the reason, an exception to raise describing the
problem.  Otherwise, ``None``.'

def _address_in_use(self, apierror):

    parts = apierror.explanation.split(':    ')
    if (parts[(-1)] == 'address    already    in    use'):
        (ip, port) = parts[(-3)].split()[(-1)].split(':')
    elif (parts[(-1)] == 'port    is    already    allocated'):
        (ip, port) = parts[(-2)].split()[2].split(':')
    else:
        return None
    return AddressInUse(address=(ip, int(port)), apierror=apierror)
