original_docstring: 
      check format requested from arguments or headers
  
      :param args: dict of request keyword value pairs
      :param headers: dict of request headers
  
      :returns: format value
      
docstring: check format requested from arguments or headers
docstring_tokens: check format requested from arguments or headers
code: def check_format(args, headers):
      """
      check format requested from arguments or headers
  
      :param args: dict of request keyword value pairs
      :param headers: dict of request headers
  
      :returns: format value
      """
  
      # Optional f=html or f=json query param
      # overrides accept
      format_ = args.get('f')
      if format_:
          return format_
  
      # Format not specified: get from accept headers
      # format_ = 'text/html'
      headers_ = None
      if 'accept' in headers.keys():
          headers_ = headers['accept']
      elif 'Accept' in headers.keys():
          headers_ = headers['Accept']
  
      format_ = None
      if headers_:
          headers_ = headers_.split(',')
  
          if 'text/html' in headers_:
              format_ = 'html'
          elif 'application/ld+json' in headers_:
              format_ = 'jsonld'
          elif 'application/json' in headers_:
              format_ = 'json'
  
      return format_
code_tokens: def check_format ( args , headers ) : format_ = args . get ( 'f' ) if format_ : return format_ headers_ = None if 'accept' in headers . keys ( ) : headers_ = headers [ 'accept' ] elif 'Accept' in headers . keys ( ) : headers_ = headers [ 'Accept' ] format_ = None if headers_ : headers_ = headers_ . split ( ',' ) if 'text/html' in headers_ : format_ = 'html' elif 'application/ld+json' in headers_ : format_ = 'jsonld' elif 'application/json' in headers_ : format_ = 'json' return format_
short_docstring: check format requested from arguments or headers
short_docstring_tokens: check format requested from arguments or headers
comment: """
      check format requested from arguments or headers
  
      :param args: dict of request keyword value pairs
      :param headers: dict of request headers
  
      :returns: format value
      """$SEP$# Optional f=html or f=json query param$SEP$# overrides accept$SEP$# Format not specified: get from accept headers$SEP$# format_ = 'text/html'