<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _query_cell(args, cell_body):
 """Implements the BigQuery cell magic for used to build SQL objects. The supported syntax is: %%bq query <args> [<inline SQL>] Args: args: the optional arguments following '%%bql query'. cell_body: the contents of the cell """

  name = args['name']
  udfs = args['udfs']
  datasources = args['datasources']
  subqueries = args['subqueries']

  # Finally build the query object
  query = bigquery.Query(cell_body, env=IPython.get_ipython().user_ns, udfs=udfs,
                         data_sources=datasources, subqueries=subqueries)

  # if no name is specified, execute this query instead of defining it
  if name is None:
    return query.execute().result()
  else:
    google.datalab.utils.commands.notebook_environment()[name] = query