import re


def find_identity_in_list(elements, identities):
    """Matches a list of identities to a list of elements.

    Args:
      elements: iterable of strings, arbitrary strings to match on.
      identities: iterable of (string, string), with first string
        being a regular expression, the second string being an identity.

    Returns:
      The identity specified in identities for the first regular expression
      matching the first element in elements.
    """
    for element in elements:
        for regex, identity in identities:
            if re.search(regex, element):
                return identity
    return None