def METHOD_NAME(value, dirname):
    frame = inspect.currentframe()
    try:
        filename = f"{frame.f_back.f_code.co_name}_line{frame.f_back.f_lineno}.report"
        filepath = os.path.join(dirname, filename)
        makefile(filepath, exist_ok=True)
        with io.open(filepath, mode="wb") as fp:
            fp.write(value)
    finally:
        del frame  # delete it just now or wont be cleaned by gc