code: def to_header(self, realm=''):
          
          oauth_params = ((k, v) for k, v in self.items() 
                              if k.startswith('oauth_'))
          stringy_params = ((k, escape(v)) for k, v in oauth_params)
          header_params = ('%s="%s"' % (k, v) for k, v in stringy_params)
          params_header = ', '.join(header_params)
   
          auth_header = 'OAuth realm="%s"' % realm
          if params_header:
              auth_header = "%s, %s" % (auth_header, params_header)
   
          return {'Authorization': auth_header}
docs: Serialize as a header for an HTTPAuth request.