human
Complete the below
def adj():

    ''''RESTful CRUD controller'
    '''
assistant
#Here is the Python code you requested.
    table = s3db.inv_adj
    error_msg = T('You    do    not    have    permission    to    adjust    the    stock    level    in    this    warehouse.')
    auth.permitted_facilities(table=table, error_msg=error_msg)
    def prep(r):
        if r.interactive:
            if r.component:
                if (r.component_name == 'adj_item'):
                    if r.component_id:
                        aitable = s3db.inv_adj_item
                        if (r.record.status == 0):
                            aitable.reason.writable = True
                        record = db((aitable.id == r.component_id)).select(aitable.inv_item_id, limitby=(0, 1)).first()
                        if record.inv_item_id:
                            aitable.item_id.writable = False
                            aitable.item_id.comment = None
                            aitable.item_pack_id.writable = False
                elif (r.component_name == 'image'):
                    doc_table = s3db.doc_image
                    doc_table.organisation_id.readable = doc_table.organisation_id.writable = False
                    doc_table.person_id.readable = doc_table.person_id.writable = False
                    doc_table.location_id.readable = doc_table.location_id.writable = False
            elif (r.record and r.record.status):
                table.adjuster_id.writable = False
                table.site_id.writable = False
                table.comments.writable = False
            elif (('item' in get_vars) and ('site' in get_vars)):
                adj_id = table.insert(adjuster_id=auth.s3_logged_in_person(), site_id=get_vars.site, adjustment_date=request.utcnow, status=0, category=1, comments='Single    item    adjustment')
                inv_item_table = s3db.inv_inv_item
                inv_item = inv_item_table[get_vars.item]
                adjitemtable = s3db.inv_adj_item
                adj_item_id = adjitemtable.insert(reason=0, adj_id=adj_id, inv_item_id=inv_item.id, item_id=inv_item.item_id,...