code: def _sanitize_windows_name(cls, arcname, pathsep):
          
          table = cls._windows_illegal_name_trans_table
          if not table:
              illegal = ':<>|"?*'
              table = str.maketrans(illegal, '_' * len(illegal))
              cls._windows_illegal_name_trans_table = table
          arcname = arcname.translate(table)
          # remove trailing dots
          arcname = (x.rstrip('.') for x in arcname.split(pathsep))
          # rejoin, removing empty parts.
          arcname = pathsep.join(x for x in arcname if x)
          return arcname
docs: Replace bad characters and remove trailing dots from parts.