code: def _extract_line(args):
    
    name = args['source']
    source = datalab.utils.commands.get_notebook_item(name)
    if not source:
      source = _get_table(name)
  
    if not source:
      raise Exception('No source named %s found' % name)
    elif isinstance(source, datalab.bigquery.Table) and not source.exists():
      raise Exception('Table %s does not exist' % name)
    else:
  
      job = source.extract(args['destination'],
                           format='CSV' if args['format'] == 'csv' else 'NEWLINE_DELIMITED_JSON',
                           compress=args['compress'],
                           csv_delimiter=args['delimiter'],
                           csv_header=args['header'])
      if job.failed:
        raise Exception('Extract failed: %s' % str(job.fatal_error))
      elif job.errors:
        raise Exception('Extract completed with errors: %s' % str(job.errors))
docs: Implements the BigQuery extract magic used to extract table data to GCS.
  
     The supported syntax is:
  
         %bigquery extract -S|--source <table> -D|--destination <url> <other_args>
  
    Args:
      args: the arguments following '%bigquery extract'.
    Returns:
      A message about whether the extract succeeded or failed.