<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(config_dir=None, optional_config_files=None, cron_cfg="cron"):
 """ Initialize everything for interactive use. Returns a ready-to-use RtorrentEngine object. """

    from pyrocore.scripts.base import ScriptBase
    from pyrocore.util import load_config

    ScriptBase.setup(cron_cfg=cron_cfg)
    load_config.ConfigLoader(config_dir).load(optional_config_files or [])

    from pyrocore import config
    config.engine.open()
    return config.engine