code: def key(state, host, key=None, keyserver=None, keyid=None):
      '''
      Add apt gpg keys with ``apt-key``.
  
      + key: filename or URL
      + keyserver: URL of keyserver to fetch key from
      + keyid: key identifier when using keyserver
  
      Note:
          Always returns an add command, not state checking.
  
      keyserver/id:
          These must be provided together.
      '''
  
      if key:
          # If URL, wget the key to stdout and pipe into apt-key, because the "adv"
          # apt-key passes to gpg which doesn't always support https!
          if urlparse(key).scheme:
              yield 'wget -O- {0} | apt-key add -'.format(key)
          else:
              yield 'apt-key add {0}'.format(key)
  
      if keyserver and keyid:
          yield 'apt-key adv --keyserver {0} --recv-keys {1}'.format(keyserver, keyidf key(state, host, key=None, keyserver=None, keyid=None):
      '''
      Add apt gpg keys with ``apt-key``.
  
      + key: filename or URL
      + keyserver: URL of keyserver to fetch key from
      + keyid: key identifier when using keyserver
  
      Note:
          Always returns an add command, not state checking.
  
      keyserver/id:
          These must be provided together.
      '''
  
      if key:
          # If URL, wget the key to stdout and pipe into apt-key, because the "adv"
          # apt-key passes to gpg which doesn't always support https!
          if urlparse(key).scheme:
              yield 'wget -O- {0} | apt-key add -'.format(key)
          else:
              yield 'apt-key add {0}'.format(key)
  
      if keyserver and keyid:
          yield 'apt-key adv --keyserver {0} --recv-keys {1}'.format(keyserver, keyid)
docs: Add apt gpg keys with ``apt-key``.
  
      + key: filename or URL
      + keyserver: URL of keyserver to fetch key from
      + keyid: key identifier when using keyserver
  
      Note:
          Always returns an add command, not state checking.
  
      keyserver/id:
          These must be provided together.