def write_sysinfo(path, val):
    """
    Writes val into the file specified by path.  Generally used for one of the
    /proc or /sys files

    :param path: Path in sysinfo to write
    :param val: New value the file will take
    :return: The value now in path
    """
    with open(path, "w") as sysinfo:
        sysinfo.write(val)
    with open(path, "r") as sysinfo:
        return sysinfo.read()