code: def find_collection(client, dbid, id):
      """Find whether or not a CosmosDB collection exists.
  
      Args:
          client (object): A pydocumentdb client object.
          dbid (str): Database ID.
          id (str): Collection ID.
  
      Returns:
          bool: True if the collection exists, False otherwise.
      """
      database_link = "dbs/" + dbid
      collections = list(
          client.QueryCollections(
              database_link,
              {
                  "query": "SELECT * FROM r WHERE r.id=@id",
                  "parameters": [{"name": "@id", "value": id}],
              },
          )
      )
      if len(collections) > 0:
          return True
      else:
          return False
  
imports: import pydocumentdb.errors
label_desc: Use image node_id 1 for calling a global function with example usage: find_collection(client, dbid, id) and returns: True, False