docs: def modified_files(root, tracked_only=False, commit=None):
      """Returns a list of files that has been modified since the last commit.
  
      Args:
        root: the root of the repository, it has to be an absolute path.
        tracked_only: exclude untracked files when True.
        commit: SHA1 of the commit. If None, it will get the modified files in the
          working copy.
  
      Returns: a dictionary with the modified files as keys, and additional
        information as value. In this case it adds the status returned by
        hg status.
      """
      assert os.path.isabs(root), "Root has to be absolute, got: %s" % root
  
      command = ['hg', 'status']
      if commit:
          command.append('--change=%s' % commit)
  
      # Convert to unicode and split
      status_lines = subprocess.check_output(command).decode('utf-8').split(
          os.linesep)
  
      modes = ['M', 'A']
      if not tracked_only:
          modes.append(r'\?')
      modes_str = '|'.join(modes)
  
      modified_file_status = utils.filter_lines(
          status_lines,
          r'(?P<mode>%s) (?P<filename>.+)' % modes_str,
          groups=('filename', 'mode'))
  
      return dict((os.path.join(root, filename), mode)
                  for filename, mode in modified_file_status)