def catch(fcn, *args, **kwargs):
try:<EOL><INDENT>spit = kwargs.pop('<STR_LIT>')<EOL><DEDENT>except:<EOL><INDENT>spit = None<EOL><DEDENT>try:<EOL><INDENT>results = fcn(*args, **kwargs)<EOL>if results:<EOL><INDENT>return results<EOL><DEDENT><DEDENT>except:<EOL><INDENT>print(traceback.format_exc())<EOL>if spit:<EOL><INDENT>return spit<EOL><DEDENT><DEDENT>
try:
          retrun fcn(*args, **kwargs)
       except:
          print traceback
            if 'spit' in kwargs.keys():
                return kwargs['spit']

    Parameters
    ----------
    fcn : function
    *args : unnamed parameters of fcn
    **kwargs : named parameters of fcn
        spit : returns the parameter named return in the exception

    Returns
    -------
    The expected output of fcn or prints the exception traceback