def _bulk_identity_factory(key_columns):
    """Return a function that accepts a dict mapping and returns its identity
    corresponding its key values mapped by `key_columns`.
    """
    return lambda mapping: tuple(mapping.get(col.key) for col in key_columns)