def CleanCommonNits(contents, extension):
  """Cleans some common artifacts left from the scrubbing process."""
  if extension in ('css', 'js'):
    new_contents = contents.replace(' \n', '\n')
    new_contents = new_contents.replace('/*\n *\n', '/*\n')
    return new_contents.replace('*\n */', '*/')

  if extension == 'html':
    return contents.replace('<!--\n-->\n', '')

  if extension == 'py':
    new_contents = contents.replace(' \n', '\n')
    return new_contents.replace('\n#\n\n', '\n\n')

  return contents