<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_engine_name(ec=None):
 """ Get the name of a engine or session """

    ec = ec or __default_engine__
    if isinstance(ec, (str, unicode)):
        return ec
    elif isinstance(ec, Session):
        return ec.engine_name
    else:
        raise Error("Parameter ec should be an engine_name or Session object, but %r found" % ec)