code: def create_view(self, dataset, view, query, use_legacy_sql=None, project_id=None):
          
          project_id = self._get_project_id(project_id)
  
          body = {
              'tableReference': {
                  'tableId': view,
                  'projectId': project_id,
                  'datasetId': dataset
              },
              'view': {
                  'query': query
              }
          }
  
          if use_legacy_sql is not None:
              body['view']['useLegacySql'] = use_legacy_sql
  
          try:
              view = self.bigquery.tables().insert(
                  projectId=project_id,
                  datasetId=dataset,
                  body=body
              ).execute(num_retries=self.num_retries)
              if self.swallow_results:
                  return True
              else:
                  return view
  
          except HttpError as e:
              logger.error(('Cannot create view {0}.{1}\n'
                            'Http Error: {2}').format(dataset, view, e.content))
              if self.swallow_results:
                  return False
              else:
                  return {}
docs: Create a new view in the dataset.
  
          Parameters
          ----------
          dataset : str
              The dataset to create the view in
          view : str
              The name of the view to create
          query : dict
              A query that BigQuery executes when the view is referenced.        
          use_legacy_sql : bool, optional
              If False, the query will use BigQuery's standard SQL
              (https://cloud.google.com/bigquery/sql-reference/)
          project_id: str, optional
              The project to create the view in
  
          Returns
          -------
          Union[bool, dict]
              bool indicating if the view was successfully created or not,
              or response from BigQuery if swallow_results is set to False.