def get_field_by_name(form, field_name):
    """
    gets a field from a form based on its name
    :param form:
    :param field_name:
    :return:
    """
    if field_name in form.fields:
        return form[field_name]
    return None