<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_session(ec=None, create=True):
 """ ec - engine_name or connection """

    
    ec = ec or __default_engine__
    if isinstance(ec, (str, unicode)):
        session = engine_manager[ec].session(create=True)
    elif isinstance(ec, Session):
        session = ec
    else:
        raise Error("Connection %r should be existed engine name or Session object" % ec)
    return session