def _find_subclass_with_field_name(schema, subclass_sets, parent_class_name, field_name):
    """Find a subclass that has a field with a given name, or return None if none exists."""
    subclasses = subclass_sets[parent_class_name]
    if parent_class_name not in subclasses:
        raise AssertionError(
            "Found a class that is not a subclass of itself, this means that the "
            "subclass_sets value is incorrectly constructed: {} {} {}".format(
                parent_class_name, subclasses, subclass_sets
            )
        )

    for subclass_name in subclasses:
        class_object = schema.get_type(subclass_name)
        if field_name in class_object.fields:
            # Found a match!
            return subclass_name

    # No match.
    return None