human
Complete the below
@frappe.whitelist()
def upload(rows=None, submit_after_import=None, ignore_encoding_errors=False, no_email=True, overwrite=None, update_only=None, ignore_links=False, pre_process=None, via_console=False, from_data_import=u'No'):

    ''''upload data'
    '''
assistant
#Here is the Python code you requested.
    frappe.flags.in_import = True
    params = json.loads((frappe.form_dict.get(u'params') or u'{}'))
    if params.get(u'submit_after_import'):
        submit_after_import = True
    if params.get(u'ignore_encoding_errors'):
        ignore_encoding_errors = True
    if (not params.get(u'no_email')):
        no_email = False
    if params.get(u'update_only'):
        update_only = True
    if params.get(u'from_data_import'):
        from_data_import = params.get(u'from_data_import')
    frappe.flags.mute_emails = no_email
    def get_data_keys_definition():
        return get_data_keys()
    def bad_template():
        frappe.throw(_(u'Please    do    not    change    the    rows    above    {0}').format(get_data_keys_definition().data_separator))
    def check_data_length():
        max_rows = 5000
        if (not data):
            frappe.throw(_(u'No    data    found'))
        elif ((not via_console) and (len(data) > max_rows)):
            frappe.throw(_(u'Only    allowed    {0}    rows    in    one    import').format(max_rows))
    def get_start_row():
        for (i, row) in enumerate(rows):
            if (row and (row[0] == get_data_keys_definition().data_separator)):
                return (i + 1)
        bad_template()
    def get_header_row(key):
        return get_header_row_and_idx(key)[0]
    def get_header_row_and_idx(key):
        for (i, row) in enumerate(header):
            if (row and (row[0] == key)):
                return (row, i)
        return ([], (-1))
    def filter_empty_columns(columns):
        empty_cols = filter((lambda x: (x in (u'', None))), columns)
        if empty_cols:
            if (columns[((-1) * len(empty_cols)):] == empty_cols):
                columns = columns[:((-1) * len(empty_cols))]
            else:
                frappe.msgprint(_(u'Please    make    sure    that    there    are    no    empty    columns    in    the    file.'), raise_exception=1)
        return columns
    def make_column_map():
        (doctype_row, row_idx) =...