Returns: tuple whose first element is a bool indicating success or failure
             and the second element is either a ret dict for salt or an object

def _common(ret, name, service_name, kwargs):
    '''
    Returns: tuple whose first element is a bool indicating success or failure
             and the second element is either a ret dict for salt or an object
    '''
    if 'interface' not in kwargs and 'public_url' not in kwargs:
        kwargs['interface'] = name
    service = __salt__['keystoneng.service_get'](name_or_id=service_name)

    if not service:
        ret['comment'] = 'Cannot find service'
        ret['result'] = False
        return (False, ret)

    filters = kwargs.copy()
    filters.pop('enabled', None)
    filters.pop('url', None)
    filters['service_id'] = service.id
    kwargs['service_name_or_id'] = service.id
    endpoints = __salt__['keystoneng.endpoint_search'](filters=filters)

    if len(endpoints) > 1:
        ret['comment'] = "Multiple endpoints match criteria"
        ret['result'] = False
        return ret
    endpoint = endpoints[0] if endpoints else None
    return (True, endpoint)