human
Complete this python program:
def activity():
assistant
#Here is the Python code you requested.

    """RESTful CRUD controller
    """
    table = s3db.project_activity
    if ('project_id' in get_vars):
        field = table.project_id
        field.default = get_vars.project_id
        field.writable = False
        field.comment = None
    def prep(r):
        if r.interactive:
            if (r.component is not None):
                component_name = r.component_name
                if (component_name == 'distribution'):
                    dtable = s3db.supply_distribution
                    f = dtable.location_id
                    f.default = r.record.location_id
                    f.readable = f.writable = False
                    f = dtable.date
                    f.default = r.record.date
                    f.readable = f.writable = False
                elif (component_name == 'document'):
                    dtable = s3db.doc_document
                    dtable.organisation_id.readable = dtable.organisation_id.writable = False
                    dtable.person_id.readable = dtable.person_id.writable = False
                    f = dtable.location_id
                    f.default = r.record.location_id
                    f.readable = f.writable = False
                    s3db.configure('doc_document', list_fields=['name', 'date'])
        return True
    s3.prep = prep
    return s3_rest_controller('project', 'activity', csv_template='activity', rheader=s3db.project_rheader)