def get_listing_content_type(req):
 query_format = get_param(req, 'format')
 if query_format:
  req.accept = FORMAT2CONTENT_TYPE.get(query_format.lower(), FORMAT2CONTENT_TYPE['plain'])
 out_content_type = req.accept.best_match(['text/plain', 'application/json', 'application/xml', 'text/xml'])
 if (not out_content_type):
  raise HTTPNotAcceptable(request=req)
 return out_content_type

def get_listing_content_type ( req ) : query_format = get_param ( req , 'format' ) if query_format : req . accept = FORMAT2CONTENT_TYPE . get ( query_format . lower ( ) , FORMAT2CONTENT_TYPE [ 'plain' ] ) out_content_type = req . accept . best_match ( [ 'text/plain' , 'application/json' , 'application/xml' , 'text/xml' ] ) if ( not out_content_type ) : raise HTTPNotAcceptable ( request = req ) return out_content_type
determine the content type to use for an account or container listing response .