<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def changed(dirname, filename='.md5', args=None, glob=None):
 """Has `glob` changed in `dirname` Args: dirname: directory to measure filename: filename to store checksum """

    root = Path(dirname)
    if not root.exists():
        # if dirname doesn't exist it is changed (by definition)
        return True

    cachefile = root / filename
    current_digest = cachefile.open().read() if cachefile.exists() else ""
    
    _digest = digest(dirname, glob=glob)
    if args and args.verbose:  # pragma: nocover
        print("md5:", _digest)
    has_changed = current_digest != _digest

    if has_changed:
        with open(os.path.join(dirname, filename), 'w') as fp:
            fp.write(_digest)

    return has_changed