code: def cloudant(user, passwd, **kwargs):
      
      cloudant_session = Cloudant(user, passwd, **kwargs)
      cloudant_session.connect()
      yield cloudant_session
      cloudant_session.disconnect()
docs: Provides a context manager to create a Cloudant session and
      provide access to databases, docs etc.
  
      :param str user: Username used to connect to Cloudant.
      :param str passwd: Authentication token used to connect to Cloudant.
      :param str account: The Cloudant account name.  If the account parameter
          is present, it will be used to construct the Cloudant service URL.
      :param str url: If the account is not present and the url parameter is
          present then it will be used to set the Cloudant service URL.  The
          url must be a fully qualified http/https URL.
      :param str x_cloudant_user: Override the X-Cloudant-User setting used to
          authenticate. This is needed to authenticate on one's behalf,
          eg with an admin account.  This parameter must be accompanied
          by the url parameter.  If the url parameter is omitted then
          the x_cloudant_user parameter setting is ignored.
      :param str encoder: Optional json Encoder object used to encode
          documents for storage. Defaults to json.JSONEncoder.
  
      For example:
  
      .. code-block:: python
  
          # cloudant context manager
          from cloudant import cloudant
  
          with cloudant(USERNAME, PASSWORD, account=ACCOUNT_NAME) as client:
              # Context handles connect() and disconnect() for you.
              # Perform library operations within this context.  Such as:
              print client.all_dbs()
              # ...