code: def get_yaml_decorators(rq):
      
      # glogger.debug('Guessing decorators for query {}'.format(rq))
      if not rq:
          return None
  
      if isinstance(rq, dict) and 'grlc' in rq:  # json query (sparql transformer)
          yaml_string = rq['grlc']
          query_string = rq
      else:  # classic query
          yaml_string = "\n".join([row.lstrip('#+') for row in rq.split('\n') if row.startswith('#+')])
          query_string = "\n".join([row for row in rq.split('\n') if not row.startswith('#+')])
  
      query_metadata = None
      if type(yaml_string) == dict:
          query_metadata = yaml_string
      elif type(yaml_string) == str:
          try:  # Invalid YAMLs will produce empty metadata
              query_metadata = yaml.load(yaml_string)
          except (yaml.parser.ParserError, yaml.scanner.ScannerError) as e:
              try:
                  query_metadata = json.loads(yaml_string)
              except json.JSONDecodeError:
                  glogger.warning("Query decorators could not be parsed; check your YAML syntax")
  
      # If there is no YAML string
      if query_metadata is None:
          query_metadata = {}
      query_metadata['query'] = query_string
  
      # glogger.debug("Parsed query decorators: {}".format(query_metadata))
  
      return query_metadata
docs: Returns the yaml decorator metadata only (this is needed by triple pattern fragments)