@register.tag
def render_form_field(parser, token):
    """
    Usage is {% render_form_field form.field_name optional_help_text optional_css_classes %}

    - optional_help_text and optional_css_classes are strings
    - if optional_help_text is not given, then it is taken from form field object
    """
    try:
        help_text = None
        css_classes = None

        token_split = token.split_contents()
        if len(token_split) == 4:
            tag_name, form_field, help_text, css_classes = token.split_contents()
        elif len(token_split) == 3:
            tag_name, form_field, help_text = token.split_contents()
        else:
            tag_name, form_field = token.split_contents()
    except __HOLE__:
        raise template.TemplateSyntaxError(
            "Unable to parse arguments for {0}".format(repr(token.contents.split()[0])))

    return FormFieldNode(form_field, help_text=help_text, css_classes=css_classes)
dataset/ETHPy150Open Tivix/django-common/django_common/templatetags/custom_tags.py/render_form_field