docs: def _arguments(code, module):
    """Define pipeline arguments.
  
    Args:
      code: the Python code to execute that defines the arguments.
  
    """
    arg_parser = CommandParser.create('')
    try:
      # Define our special argument 'types' and add them to the environment.
      builtins = {'source': _table, 'datestring': _datestring}
      env = {}
      env.update(builtins)
  
      # Execute the cell which should be one or more calls to arg().
      exec(code, env)
  
      # Iterate through the module dictionary. For any newly defined objects,
      # add args to the parser.
      for key in env:
  
        # Skip internal/private stuff.
        if key in builtins or key[0] == '_':
          continue
        # If we want to support importing query modules into other query modules, uncomment next 4
        # Skip imports but add them to the module
        # if isinstance(env[key], types.ModuleType):
        #   module.__dict__[key] = env[key]
        #   continue
  
        val = env[key]
        key = '--%s' % key
  
        if isinstance(val, bool):
          if val:
            arg_parser.add_argument(key, default=val, action='store_true')
          else:
            arg_parser.add_argument(key, default=val, action='store_false')
        elif isinstance(val, basestring) or isinstance(val, int) or isinstance(val, float) \
                or isinstance(val, int):
          arg_parser.add_argument(key, default=val)
        elif isinstance(val, list):
          arg_parser.add_argument(key, default=val, nargs='+')
        elif isinstance(val, tuple):
          arg_parser.add_argument(key, default=list(val), nargs='+')
  
        # Is this one of our pseudo-types for dates/tables?
        elif isinstance(val, dict) and 'type' in val:
          if val['type'] == 'datestring':
            arg_parser.add_argument(key, default='',
                                    type=_make_string_formatter(val['format'],
                                                                offset=val['offset']))
          elif val['type'] == 'table':
            if val['format'] is not None:
              arg_parser.add_argument(key, default='',
                                      type=_make_table_formatter(val['format'],
                                                                 offset=val['offset']))
            else:
              arg_parser.add_argument(key, default=val['name'], type=_make_table)
          else:
            raise Exception('Cannot generate argument for %s of type %s' % (key, type(val)))
        else:
          raise Exception('Cannot generate argument for %s of type %s' % (key, type(val)))
  
    except Exception as e:
      print("%%sql arguments: %s from code '%s'" % (str(e), str(code)))
    return arg_parser