<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shell(filepath, wsgiapp, interpreter, models):
 """ Runs a python shell. Usage: $ wsgicli shell app.py app -i ipython """

    model_base_classes = get_model_base_classes()
    imported_objects = {}

    if models and model_base_classes:
        insert_import_path_to_sys_modules(filepath)

        for module in find_modules_from_path(filepath):
            for name in dir(module):
                if name.startswith('_'):
                    continue
                obj = getattr(module, name)
                if isinstance(obj, model_base_classes):
                    key = name.split('.')[-1] if '.' in name else name
                    if key in imported_objects:
                        continue
                    imported_objects[key] = obj

    module = SourceFileLoader('module', filepath).load_module()
    imported_objects['app'] = getattr(module, wsgiapp)

    for key in imported_objects.keys():
        click.secho("import {}".format(key), fg='green')
    run_python(interpreter, imported_objects)