def _get_source_info(obj, default='[unknown file]'):
    'Try to get the definition file and line of obj.\n\n     Return default on error.\n     '
    try:
        source_file = inspect.getsourcefile(obj)
        source_lines = inspect.findsource(obj)
        source_info = '{}:{}'.format(source_file, source_lines[1])
    except Exception:
        source_info = default
    return source_info
Try to get the definition file and line of obj.

Return default on error.
def _get_source_info(obj, default='[unknown file]'):
    'Try to get the definition file and line of obj.\n\n     Return default on error.\n     '
    try:
        source_file = inspect.getsourcefile(obj)
        source_lines = inspect.findsource(obj)
        source_info = '{}:{}'.format(source_file, source_lines[1])
    except Exception:
        source_info = default
    return source_info