def create_spider_for_request(spidermanager, request, default_spider=None, log_none=False, log_multiple=False, **spider_kwargs):
 snames = spidermanager.find_by_request(request)
 if (len(snames) == 1):
  return spidermanager.create(snames[0], **spider_kwargs)
 if ((len(snames) > 1) and log_multiple):
  log.msg(('More than one spider can handle: %s - %s' % (request, ', '.join(snames))), log.ERROR)
 if ((len(snames) == 0) and log_none):
  log.msg(('Unable to find spider that handles: %s' % request), log.ERROR)
 return default_spider

def create_spider_for_request ( spidermanager , request , default_spider = None , log_none = False , log_multiple = False , ** spider_kwargs ) : snames = spidermanager . find_by_request ( request ) if ( len ( snames ) == 1 ) : return spidermanager . create ( snames [ 0 ] , ** spider_kwargs ) if ( ( len ( snames ) > 1 ) and log_multiple ) : log . msg ( ( 'More than one spider can handle: %s - %s' % ( request , ', ' . join ( snames ) ) ) , log . ERROR ) if ( ( len ( snames ) == 0 ) and log_none ) : log . msg ( ( 'Unable to find spider that handles: %s' % request ) , log . ERROR ) return default_spider
create a spider to handle the given request .