human
Complete this python program:
def make_layout(doc, meta, format_data=None):
assistant
#Here is the Python code you requested.

    """Builds a hierarchical layout object from the fields list to be rendered
    by `standard.html`
    :param doc: Document to be rendered.
    :param meta: Document meta object (doctype).
    :param format_data: Fields sequence and properties defined by Print Format Builder.
    """
    (layout, page) = ([], [])
    layout.append(page)
    if format_data:
        if (format_data[0].get(u'fieldname') == u'print_heading_template'):
            doc.print_heading_template = format_data[0].get(u'options')
            format_data = format_data[1:]
    def get_new_section():
        return {u'columns': [], u'has_data': False}
    def append_empty_field_dict_to_page_column(page):
        u'    append    empty    columns    dict    to    page    layout    '
        if (not page[(-1)][u'columns']):
            page[(-1)][u'columns'].append({u'fields': []})
    for df in (format_data or meta.fields):
        if format_data:
            df = frappe._dict(df)
            if df.fieldname:
                original = meta.get_field(df.fieldname)
                if original:
                    newdf = original.as_dict()
                    newdf.update(df)
                    df = newdf
            df.print_hide = 0
        if ((df.fieldtype == u'Section    Break') or (page == [])):
            if (len(page) > 1):
                if (page[(-1)][u'has_data'] == False):
                    del page[(-1)]
            section = get_new_section()
            if ((df.fieldtype == u'Section    Break') and df.label):
                section[u'label'] = df.label
            page.append(section)
        elif (df.fieldtype == u'Column    Break'):
            page[(-1)][u'columns'].append({u'fields': []})
        else:
            append_empty_field_dict_to_page_column(page)
        if ((df.fieldtype == u'HTML') and df.options):
            doc.set(df.fieldname, True)
        if (is_visible(df, doc) and has_value(df, doc)):
            append_empty_field_dict_to_page_column(page)
            page[(-1)][u'columns'][(-1)][u'fields'].append(df)
            page[(-1)][u'has_data'] = True
            if (df.fieldtype == u'Table'):
                df.rows = []
                df.start = 0
                df.end = None
                for (i, row) in enumerate(doc.get(df.fieldname)):
                    if...