def code_line(func, show_source: bool = False) -> Optional[str]:
    """Get a string representation of the location of the given function
    `func`."""

    if isinstance(func, inspect.FrameInfo):
        ret = f"{func.filename}:{func.lineno}"
        if show_source and func.code_context is not None:
            ret += "\n"
            for line in func.code_context:
                ret += "\t" + line

        return ret

    if inspect.isframe(func):
        code = func.f_code
        ret = f"{func.f_code.co_filename}:{func.f_code.co_firstlineno}"

    elif safe_hasattr(func, "__code__"):
        code = func.__code__
        ret = f"{code.co_filename}:{code.co_firstlineno}"

    else:
        return None

    if show_source:
        try:
            ret += "\n"
            for line in inspect.getsourcelines(func)[0]:
                ret += "\t" + str(line)
        except OSError as e:
            ret += f"Source code cannot be retrieved: {e}"

    return ret
Get a string representation of the location of the given function
    `func`.
src/core/trulens/core/utils/python.py