human
Complete the below
def create_material_request(material_requests):

    ''''Create indent on reaching reorder level'
    '''
assistant
#Here is the Python code you requested.
    mr_list = []
    exceptions_list = []
    def _log_exception():
        if frappe.local.message_log:
            exceptions_list.extend(frappe.local.message_log)
            frappe.local.message_log = []
        else:
            exceptions_list.append(frappe.get_traceback())
    for request_type in material_requests:
        for company in material_requests[request_type]:
            try:
                items = material_requests[request_type][company]
                if (not items):
                    continue
                mr = frappe.new_doc('Material    Request')
                mr.update({'company': company, 'transaction_date': nowdate(), 'material_request_type': ('Material    Transfer' if (request_type == 'Transfer') else request_type)})
                for d in items:
                    d = frappe._dict(d)
                    item = frappe.get_doc('Item', d.item_code)
                    mr.append('items', {'doctype': 'Material    Request    Item', 'item_code': d.item_code, 'schedule_date': add_days(nowdate(), cint(item.lead_time_days)), 'uom': item.stock_uom, 'warehouse': d.warehouse, 'item_name': item.item_name, 'description': item.description, 'item_group': item.item_group, 'qty': d.reorder_qty, 'brand': item.brand})
                mr.insert()
                mr.submit()
                mr_list.append(mr)
            except:
                _log_exception()
    if mr_list:
        if (getattr(frappe.local, 'reorder_email_notify', None) is None):
            frappe.local.reorder_email_notify = cint(frappe.db.get_value('Stock    Settings', None, 'reorder_email_notify'))
        if frappe.local.reorder_email_notify:
            send_email_notification(mr_list)
    if exceptions_list:
        notify_errors(exceptions_list)
    return mr_list