docs: def _get_query_argument(args, cell, env):
    """ Get a query argument to a cell magic.
  
    The query is specified with args['query']. We look that up and if it is a BQ query
    object, just return it. If it is a string, build a query object out of it and return
    that
  
    Args:
      args: the dictionary of magic arguments.
      cell: the cell contents which can be variable value overrides (if args has a 'query'
          value) or inline SQL otherwise.
      env: a dictionary that is used for looking up variable values.
  
    Returns:
      A Query object.
    """
    sql_arg = args.get('query', None)
    if sql_arg is None:
      # Assume we have inline SQL in the cell
      if not isinstance(cell, basestring):
        raise Exception('Expected a --query argument or inline SQL')
      return bigquery.Query(cell, env=env)
  
    item = google.datalab.utils.commands.get_notebook_item(sql_arg)
    if isinstance(item, bigquery.Query):
      return item
    else:
      raise Exception('Expected a query object, got %s.' % type(item))