def find_endpoint(dc_type, dc_id):
    """Find a docker cloud endpoint by its name or UUID."""
    units = dc_type.list(name=dc_id)  # make threaded?
    units += dc_type.list(uuid=dc_id)
    assert len(units) == 1, "%d objects found, expected 1" % (len(units),)
    return units[0]