<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_session_engine(uri=None, cfg=None):
 """ Create an sqlalchemy session and engine. :param str uri: The database URI to connect to :param cfg: The configuration object with database URI info. :return: The session and the engine as a list (in that order) """

    if uri is not None:
        eng = sa.create_engine(uri)
    elif cfg is not None:
        eng = sa.create_engine(cfg.get('db', 'SA_ENGINE_URI'))
    else:
        raise IOError("unable to connect to SQL database")
    ses = orm.sessionmaker(bind=eng)()
    return ses, eng