def METHOD_NAME(filename="~/.history"):
    expanded = os.path.expanduser(filename)
    with open(expanded, 'w') as f:
        for line in _reader.history.entries():
            f.write(line.value().encode("utf-8"))
            f.write("\n")