def split_context(method, args, kwargs):
 pos = (len(getargspec(method).args) - 1)
 if (pos < len(args)):
  return (args[pos], args[:pos], kwargs)
 else:
  return (kwargs.pop('context', None), args, kwargs)

def split_context ( method , args , kwargs ) : pos = ( len ( getargspec ( method ) . args ) - 1 ) if ( pos < len ( args ) ) : return ( args [ pos ] , args [ : pos ] , kwargs ) else : return ( kwargs . pop ( 'context' , None ) , args , kwargs )
extract the context from a pair of positional and keyword arguments .