nodes: 0, module; 1, function_definition; 2, function_name:get_statements; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, expression_statement; 18, expression_statement; 19, comment:# Format the result appropriately.; 20, if_statement; 21, return_statement; 22, identifier:subject; 23, None; 24, identifier:object; 25, None; 26, identifier:agents; 27, None; 28, identifier:stmt_type; 29, None; 30, identifier:use_exact_type; 31, False; 32, identifier:persist; 33, True; 34, identifier:timeout; 35, None; 36, identifier:simple_response; 37, False; 38, identifier:ev_limit; 39, integer:10; 40, identifier:best_first; 41, True; 42, identifier:tries; 43, integer:2; 44, identifier:max_stmts; 45, None; 46, comment:"""Get a processor for the INDRA DB web API matching given agents and type.
  
      There are two types of responses available. You can just get a list of
      INDRA Statements, or you can get an IndraDBRestProcessor object, which allow
      Statements to be loaded in a background thread, providing a sample of the
      best* content available promptly in the sample_statements attribute, and
      populates the statements attribute when the paged load is complete.
  
      The latter should be used in all new code, and where convenient the prior
      should be converted to use the processor, as this option may be removed in
      the future.
  
      * In the sense of having the most supporting evidence.
  
      Parameters
      ----------
      subject/object : str
          Optionally specify the subject and/or object of the statements in
          you wish to get from the database. By default, the namespace is assumed
          to be HGNC gene names, however you may specify another namespace by
          including `@<namespace>` at the end of the name string. For example, if
          you want to specify an agent by chebi, you could use `CHEBI:6801@CHEBI`,
          or if you wanted to use the HGNC id, you could use `6871@HGNC`.
      agents : list[str]
          A list of agents, specified in the same manner as subject and object,
          but without specifying their grammatical position.
      stmt_type : str
          Specify the types of interactions you are interested in, as indicated
          by the sub-classes of INDRA's Statements. This argument is *not* case
          sensitive. If the statement class given has sub-classes
          (e.g. RegulateAmount has IncreaseAmount and DecreaseAmount), then both
          the class itself, and its subclasses, will be queried, by default. If
          you do not want this behavior, set use_exact_type=True. Note that if
          max_stmts is set, it is possible only the exact statement type will
          be returned, as this is the first searched. The processor then cycles
          through the types, getting a page of results for each type and adding it
          to the quota, until the max number of statements is reached.
      use_exact_type : bool
          If stmt_type is given, and you only want to search for that specific
          statement type, set this to True. Default is False.
      persist : bool
          Default is True. When False, if a query comes back limited (not all
          results returned), just give up and pass along what was returned.
          Otherwise, make further queries to get the rest of the data (which may
          take some time).
      timeout : positive int or None
          If an int, block until the work is done and statements are retrieved, or
          until the timeout has expired, in which case the results so far will be
          returned in the response object, and further results will be added in
          a separate thread as they become available. If simple_response is True,
          all statements available will be returned. Otherwise (if None), block
          indefinitely until all statements are retrieved. Default is None.
      simple_response : bool
          If True, a simple list of statements is returned (thus block should also
          be True). If block is False, only the original sample will be returned
          (as though persist was False), until the statements are done loading, in
          which case the rest should appear in the list. This behavior is not
          encouraged. Default is False (which breaks backwards compatibility with
          usage of INDRA versions from before 1/22/2019). WE ENCOURAGE ALL NEW
          USE-CASES TO USE THE PROCESSOR, AS THIS FEATURE MAY BE REMOVED AT A
          LATER DATE.
      ev_limit : int or None
          Limit the amount of evidence returned per Statement. Default is 10.
      best_first : bool
          If True, the preassembled statements will be sorted by the amount of
          evidence they have, and those with the most evidence will be
          prioritized. When using `max_stmts`, this means you will get the "best"
          statements. If False, statements will be queried in arbitrary order.
      tries : int > 0
          Set the number of times to try the query. The database often caches
          results, so if a query times out the first time, trying again after a
          timeout will often succeed fast enough to avoid a timeout. This can also
          help gracefully handle an unreliable connection, if you're willing to
          wait. Default is 2.
      max_stmts : int or None
          Select the maximum number of statements to return. When set less than
          1000 the effect is much the same as setting persist to false, and will
          guarantee a faster response. Default is None.
  
      Returns
      -------
      processor : :py:class:`IndraDBRestProcessor`
          An instance of the IndraDBRestProcessor, which has an attribute
          `statements` which will be populated when the query/queries are done.
          This is the default behavior, and is encouraged in all future cases,
          however a simple list of statements may be returned using the
          `simple_response` option described above.
      """; 47, assignment; 48, identifier:simple_response; 49, block; 50, else_clause; 51, identifier:ret; 52, identifier:processor; 53, call; 54, expression_statement; 55, block; 56, identifier:IndraDBRestProcessor; 57, argument_list; 58, assignment; 59, expression_statement; 60, identifier:subject; 61, identifier:object; 62, identifier:agents; 63, identifier:stmt_type; 64, identifier:use_exact_type; 65, identifier:persist; 66, identifier:timeout; 67, identifier:ev_limit; 68, identifier:best_first; 69, identifier:tries; 70, identifier:max_stmts; 71, identifier:ret; 72, attribute; 73, assignment; 74, identifier:processor; 75, identifier:statements; 76, identifier:ret; 77, identifier:processor
code: def get_statements(subject=None, object=None, agents=None, stmt_type=None,
                     use_exact_type=False, persist=True, timeout=None,
                     simple_response=False, ev_limit=10, best_first=True, tries=2,
                     max_stmts=None):
      """Get a processor for the INDRA DB web API matching given agents and type.
  
      There are two types of responses available. You can just get a list of
      INDRA Statements, or you can get an IndraDBRestProcessor object, which allow
      Statements to be loaded in a background thread, providing a sample of the
      best* content available promptly in the sample_statements attribute, and
      populates the statements attribute when the paged load is complete.
  
      The latter should be used in all new code, and where convenient the prior
      should be converted to use the processor, as this option may be removed in
      the future.
  
      * In the sense of having the most supporting evidence.
  
      Parameters
      ----------
      subject/object : str
          Optionally specify the subject and/or object of the statements in
          you wish to get from the database. By default, the namespace is assumed
          to be HGNC gene names, however you may specify another namespace by
          including `@<namespace>` at the end of the name string. For example, if
          you want to specify an agent by chebi, you could use `CHEBI:6801@CHEBI`,
          or if you wanted to use the HGNC id, you could use `6871@HGNC`.
      agents : list[str]
          A list of agents, specified in the same manner as subject and object,
          but without specifying their grammatical position.
      stmt_type : str
          Specify the types of interactions you are interested in, as indicated
          by the sub-classes of INDRA's Statements. This argument is *not* case
          sensitive. If the statement class given has sub-classes
          (e.g. RegulateAmount has IncreaseAmount and DecreaseAmount), then both
          the class itself, and its subclasses, will be queried, by default. If
          you do not want this behavior, set use_exact_type=True. Note that if
          max_stmts is set, it is possible only the exact statement type will
          be returned, as this is the first searched. The processor then cycles
          through the types, getting a page of results for each type and adding it
          to the quota, until the max number of statements is reached.
      use_exact_type : bool
          If stmt_type is given, and you only want to search for that specific
          statement type, set this to True. Default is False.
      persist : bool
          Default is True. When False, if a query comes back limited (not all
          results returned), just give up and pass along what was returned.
          Otherwise, make further queries to get the rest of the data (which may
          take some time).
      timeout : positive int or None
          If an int, block until the work is done and statements are retrieved, or
          until the timeout has expired, in which case the results so far will be
          returned in the response object, and further results will be added in
          a separate thread as they become available. If simple_response is True,
          all statements available will be returned. Otherwise (if None), block
          indefinitely until all statements are retrieved. Default is None.
      simple_response : bool
          If True, a simple list of statements is returned (thus block should also
          be True). If block is False, only the original sample will be returned
          (as though persist was False), until the statements are done loading, in
          which case the rest should appear in the list. This behavior is not
          encouraged. Default is False (which breaks backwards compatibility with
          usage of INDRA versions from before 1/22/2019). WE ENCOURAGE ALL NEW
          USE-CASES TO USE THE PROCESSOR, AS THIS FEATURE MAY BE REMOVED AT A
          LATER DATE.
      ev_limit : int or None
          Limit the amount of evidence returned per Statement. Default is 10.
      best_first : bool
          If True, the preassembled statements will be sorted by the amount of
          evidence they have, and those with the most evidence will be
          prioritized. When using `max_stmts`, this means you will get the "best"
          statements. If False, statements will be queried in arbitrary order.
      tries : int > 0
          Set the number of times to try the query. The database often caches
          results, so if a query times out the first time, trying again after a
          timeout will often succeed fast enough to avoid a timeout. This can also
          help gracefully handle an unreliable connection, if you're willing to
          wait. Default is 2.
      max_stmts : int or None
          Select the maximum number of statements to return. When set less than
          1000 the effect is much the same as setting persist to false, and will
          guarantee a faster response. Default is None.
  
      Returns
      -------
      processor : :py:class:`IndraDBRestProcessor`
          An instance of the IndraDBRestProcessor, which has an attribute
          `statements` which will be populated when the query/queries are done.
          This is the default behavior, and is encouraged in all future cases,
          however a simple list of statements may be returned using the
          `simple_response` option described above.
      """
      processor = IndraDBRestProcessor(subject, object, agents, stmt_type,
                                       use_exact_type, persist, timeout,
                                       ev_limit, best_first, tries, max_stmts)
  
      # Format the result appropriately.
      if simple_response:
          ret = processor.statements
      else:
          ret = processor
      return ret