def handler_url(block, handler_name, suffix='', query='', thirdparty=False):
 view_name = 'xblock_handler'
 if handler_name:
  func = getattr(block.__class__, handler_name, None)
  if (not func):
   raise ValueError('{!r} is not a function name'.format(handler_name))
 if thirdparty:
  view_name = 'xblock_handler_noauth'
 url = reverse(view_name, kwargs={'course_id': unicode(block.location.course_key), 'usage_id': quote_slashes(unicode(block.scope_ids.usage_id).encode('utf-8')), 'handler': handler_name, 'suffix': suffix})
 if (not suffix):
  url = url.rstrip('/')
 if query:
  url += ('?' + query)
 if thirdparty:
  scheme = ('https' if (settings.HTTPS == 'on') else 'http')
  url = '{scheme}://{host}{path}'.format(scheme=scheme, host=settings.SITE_NAME, path=url)
 return url

def handler_url ( block , handler_name , suffix = '' , query = '' , thirdparty = False ) : view_name = 'xblock_handler' if handler_name : func = getattr ( block . __class__ , handler_name , None ) if ( not func ) : raise ValueError ( '{!r} is not a function name' . format ( handler_name ) ) if thirdparty : view_name = 'xblock_handler_noauth' url = reverse ( view_name , kwargs = { 'course_id' : unicode ( block . location . course_key ) , 'usage_id' : quote_slashes ( unicode ( block . scope_ids . usage_id ) . encode ( 'utf-8' ) ) , 'handler' : handler_name , 'suffix' : suffix } ) if ( not suffix ) : url = url . rstrip ( '/' ) if query : url += ( '?' + query ) if thirdparty : scheme = ( 'https' if ( settings . HTTPS == 'on' ) else 'http' ) url = '{scheme}://{host}{path}' . format ( scheme = scheme , host = settings . SITE_NAME , path = url ) return url
this method matches the signature for xblock .