code: def _write_cache(self, lines, append=False):
          
          mode = 'at' if append else 'wt'
          with open(self.filepath, mode, encoding='utf8') as fh:
              fh.writelines(line + '\n' for line in lines)
docs: Write virtualenv metadata to cache.