(query, value)
Adds an identity filter to a query.

    Filters results by ID, if supplied value is a valid integer.
    Otherwise attempts to filter results by UUID.

    :param query: Initial query to add filter to.
    :param value: Value for filtering results by.
    :return: Modified query.
Adds an identity filter to a query.
Adds an identity filter to a query .
def add_identity_filter(query, value):
    """Adds an identity filter to a query.

    Filters results by ID, if supplied value is a valid integer.
    Otherwise attempts to filter results by UUID.

    :param query: Initial query to add filter to.
    :param value: Value for filtering results by.
    :return: Modified query.
    """
    if strutils.is_int_like(value):
        return query.filter_by(id=value)
    elif uuidutils.is_uuid_like(value):
        return query.filter_by(uuid=value)
    else:
        raise exception.InvalidIdentity(identity=value)
def add_identity_filter ( query , value ) : if strutils . is_int_like ( value ) : return query . filter_by ( id = value ) elif uuidutils . is_uuid_like ( value ) : return query . filter_by ( uuid = value ) else : raise exception . InvalidIdentity ( identity = value )