def METHOD_NAME(field):
    if not hasattr(field, "form") or \
            not hasattr(field.form, "visirules") or \
            field.html_name not in field.form.visirules:
        return ""
    rule = field.form.visirules[field.html_name]
    return mark_safe(
        " data-visibility-field='{}' data-visibility-value='{}' "
        .format(rule["field"], rule["value"]))