code: def _compile_output_step(outputs):
      
      if not outputs:
          raise GraphQLCompilationError(u'No fields were selected for output! Please mark at least '
                                        u'one field with the @output directive.')
  
      output_fields = {}
      for output_name, output_context in six.iteritems(outputs):
          location = output_context['location']
          optional = output_context['optional']
          graphql_type = output_context['type']
  
          expression = None
          existence_check = None
          # pylint: disable=redefined-variable-type
          if isinstance(location, FoldScopeLocation):
              if optional:
                  raise AssertionError(u'Unreachable state reached, optional in fold: '
                                       u'{}'.format(output_context))
  
              if location.field == COUNT_META_FIELD_NAME:
                  expression = expressions.FoldCountContextField(location)
              else:
                  expression = expressions.FoldedContextField(location, graphql_type)
          else:
              expression = expressions.OutputContextField(location, graphql_type)
  
              if optional:
                  existence_check = expressions.ContextFieldExistence(location.at_vertex())
  
          if existence_check:
              expression = expressions.TernaryConditional(
                  existence_check, expression, expressions.NullLiteral)
          # pylint: enable=redefined-variable-type
  
          output_fields[output_name] = expression
  
      return blocks.ConstructResult(output_fields)
docs: Construct the final ConstructResult basic block that defines the output format of the query.
  
      Args:
          outputs: dict, output name (string) -> output data dict, specifying the location
                   from where to get the data, and whether the data is optional (and therefore
                   may be missing); missing optional data is replaced with 'null'
  
      Returns:
          a ConstructResult basic block that constructs appropriate outputs for the query