def METHOD_NAME(err) -> None:
    if err is None:
        # Try to get the `errno` variable value
        # if it does not exist, get the errno variable from its location
        try:
            err = int(gdb.parse_and_eval("errno"))
        except gdb.error:
            try:
                # We can't simply call __errno_location because its .plt.got entry may be uninitialized
                # (e.g. if the binary was just started with `starti` command)
                # So we have to check the got.plt entry first before calling it
                errno_loc_gotplt = pwndbg.gdblib.symbol.address("__errno_location@got.plt")
                # If the got.plt entry is not there (is None), it means the symbol is not used by the binary
                if errno_loc_gotplt is None or pwndbg.gdblib.vmmap.find(
                    pwndbg.gdblib.memory.pvoid(errno_loc_gotplt)
                ):
                    err = int(
                        parse_and_eval_with_scheduler_lock(
                            "*((int *(*) (void)) __errno_location) ()"
                        )
                    )
                else:
                    print(
                        "Could not determine error code automatically: the __errno_location@got.plt has no valid address yet (perhaps libc.so hasn't been loaded yet?)"
                    )
                    return
            except gdb.error:
                print(
                    "Could not determine error code automatically: neither `errno` nor `__errno_location` symbols were provided (perhaps libc.so hasn't been not loaded yet?)"
                )
                return
    msg = errno.errorcode.get(int(err), "Unknown error code")
    print(f"Errno {err}: {msg}")