def get_field_by_data_key(schema, data_key):
    """Helper method to get a field from schema by data_key name.

    :param schema: Instantiated schema.
    :type schema: :class:`~marshmallow.schema.Schema`
    :param str data_key: Name as the field as it was serialized.
    :return: The schema field if found, None otherwise.
    :rtype: :class:`~marshmallow.fields.Field` or None

    """
    field = None
    if hasattr(schema, "fields_by_data_key"):
        if data_key in schema.fields_by_data_key:
            field = schema.fields_by_data_key[data_key]
    else:
        for field_name in schema.fields:
            field_data_name = schema.fields[field_name].data_key or field_name
            if field_data_name == data_key:
                field = schema.fields[field_name]
                break
    return field