nodes: 0, module; 1, function_definition; 2, function_name:get_collections; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, return_statement; 15, identifier:collection; 16, None; 17, identifier:prefix; 18, None; 19, identifier:suffix; 20, None; 21, string; 22, comparison_operator:collection is not None; 23, block; 24, assignment; 25, comparison_operator:prefix is not None; 26, block; 27, comparison_operator:suffix is not None; 28, block; 29, call; 30, string_content:Returns a sorted list of collection names found in ``db``.
  
      Arguments:
  
          db (Database): A pymongo Database object. Can be obtained
              with ``get_db``.
  
          collection (str): Name of a collection. If the collection is
              present in the MongoDB database, a single-element list will
              be returned with the collecion name. If not, an empty list
              will be returned. This option is primarly included to allow
              for quick checking to see if a collection name is present.
              Default is None, which results in this option being ignored.
  
          prefix (str): If supplied, only collections that begin with
              ``prefix`` will be returned.
  
          suffix (str): If supplied, only collections that end with
              ``suffix`` will be returned.
  
      Returns:
  
          list: A sorted list of collection names.; 31, identifier:collection; 32, None; 33, return_statement; 34, identifier:collections; 35, call; 36, identifier:prefix; 37, None; 38, expression_statement; 39, identifier:suffix; 40, None; 41, expression_statement; 42, identifier:sorted; 43, argument_list; 44, list; 45, attribute; 46, argument_list; 47, assignment; 48, assignment; 49, identifier:collections; 50, identifier:collection; 51, identifier:db; 52, identifier:collection_names; 53, keyword_argument; 54, identifier:collections; 55, list_comprehension; 56, identifier:collections; 57, list_comprehension; 58, identifier:include_system_collections; 59, False; 60, identifier:c; 61, for_in_clause; 62, if_clause; 63, identifier:c; 64, for_in_clause; 65, if_clause; 66, identifier:c; 67, identifier:collections; 68, call; 69, identifier:c; 70, identifier:collections; 71, call; 72, attribute; 73, argument_list; 74, attribute; 75, argument_list; 76, identifier:c; 77, identifier:startswith; 78, identifier:prefix; 79, identifier:c; 80, identifier:endswith; 81, identifier:suffix
code: def get_collections(db, collection=None, prefix=None, suffix=None):
      '''
      Returns a sorted list of collection names found in ``db``.
  
      Arguments:
  
          db (Database): A pymongo Database object. Can be obtained
              with ``get_db``.
  
          collection (str): Name of a collection. If the collection is
              present in the MongoDB database, a single-element list will
              be returned with the collecion name. If not, an empty list
              will be returned. This option is primarly included to allow
              for quick checking to see if a collection name is present.
              Default is None, which results in this option being ignored.
  
          prefix (str): If supplied, only collections that begin with
              ``prefix`` will be returned.
  
          suffix (str): If supplied, only collections that end with
              ``suffix`` will be returned.
  
      Returns:
  
          list: A sorted list of collection names.
      '''
      if collection is not None:
          return [collection, ]
      collections = db.collection_names(include_system_collections=False)
      if prefix is not None:
          collections = [c for c in collections if c.startswith(prefix)]
      if suffix is not None:
          collections = [c for c in collections if c.endswith(suffix)]
      return sorted(collections)