code: def _datasource_cell(args, cell_body):
    
    name = args['name']
    paths = args['paths']
    data_format = (args['format'] or 'CSV').lower()
    compressed = args['compressed'] or False
  
    # Get the source schema from the cell body
    record = google.datalab.utils.commands.parse_config(
        cell_body, google.datalab.utils.commands.notebook_environment(), as_dict=False)
  
    jsonschema.validate(record, BigQuerySchema.TABLE_SCHEMA_SCHEMA)
    schema = bigquery.Schema(record['schema'])
  
    # Finally build the datasource object
    datasource = bigquery.ExternalDataSource(source=paths, source_format=data_format,
                                             compressed=compressed, schema=schema)
    google.datalab.utils.commands.notebook_environment()[name] = datasource
docs: Implements the BigQuery datasource cell magic for ipython notebooks.
  
    The supported syntax is
    %%bq datasource --name <var> --paths <url> [--format <CSV|JSON>]
    <schema>
  
    Args:
      args: the optional arguments following '%%bq datasource'
      cell_body: the datasource's schema in json/yaml