code: def _del_repo_from_file(repo, filepath):
      '''
      Remove a repo from filepath
      '''
      with salt.utils.files.fopen(filepath) as fhandle:
          output = []
          regex = re.compile(REPO_REGEXP)
          for line in fhandle:
              line = salt.utils.stringutils.to_unicode(line)
              if regex.search(line):
                  if line.startswith('#'):
                      line = line[1:]
                  cols = salt.utils.args.shlex_split(line.strip())
                  if repo != cols[1]:
                      output.append(salt.utils.stringutils.to_str(line))
      with salt.utils.files.fopen(filepath, 'w') as fhandle:
          fhandle.writelines(outputf _del_repo_from_file(repo, filepath):
      '''
      Remove a repo from filepath
      '''
      with salt.utils.files.fopen(filepath) as fhandle:
          output = []
          regex = re.compile(REPO_REGEXP)
          for line in fhandle:
              line = salt.utils.stringutils.to_unicode(line)
              if regex.search(line):
                  if line.startswith('#'):
                      line = line[1:]
                  cols = salt.utils.args.shlex_split(line.strip())
                  if repo != cols[1]:
                      output.append(salt.utils.stringutils.to_str(line))
      with salt.utils.files.fopen(filepath, 'w') as fhandle:
          fhandle.writelines(output)
docs: Remove a repo from filepath