def label(code):
    """ Return a (filename, first_lineno, func_name) tuple for a given code
    object.
    """
    if isinstance(code, str):
        return ('~', 0, code)
    elif isinstance(code, tuple):
        return code
    else:
        return (code.co_filename, code.co_firstlineno, code.co_name)