code: def collect(val, collections, default_collections):
      """Adds keys to a collection.
  
      Args:
        val: The value to add per each key.
        collections: A collection of keys to add.
        default_collections: Used if collections is None.
      """
      if collections is None:
          collections = default_collections
      for key in collections:
          ops.add_to_collection(key, val)
  
imports: import contextlib
  import re
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 1 for calling a global function with example usage: collect(val, collections, default_collections) without return types