code: def add_apt_source(source, key=None, update=True):
      
  
      # Make a backup of list
      source_list = u'/etc/apt/sources.list'
      sudo("cp %s{,.bak}" % source_list)
      files.append(source_list, source, use_sudo=True)
      if key:
          # Fecth key from url and add
          sudo(u"wget -q %s -O - | sudo apt-key add -" % key)
      if update:
          update_apt_sources()
docs: Adds source url to apt sources.list. Optional to pass the key url.