def function_namespace(f, args=None):
 m_args = inspect.getargspec(f)[0]
 if (len(m_args) and args):
  if (m_args[0] == 'self'):
   return ('%s.%s.%s' % (f.__module__, args[0].__class__.__name__, f.__name__))
  elif (m_args[0] == 'cls'):
   return ('%s.%s.%s' % (f.__module__, args[0].__name__, f.__name__))
 if hasattr(f, 'im_func'):
  return ('%s.%s.%s' % (f.__module__, f.im_class.__name__, f.__name__))
 elif hasattr(f, '__class__'):
  return ('%s.%s.%s' % (f.__module__, f.__class__.__name__, f.__name__))
 else:
  return ('%s.%s' % (f.__module__, f.__name__))

def function_namespace ( f , args = None ) : m_args = inspect . getargspec ( f ) [ 0 ] if ( len ( m_args ) and args ) : if ( m_args [ 0 ] == 'self' ) : return ( '%s.%s.%s' % ( f . __module__ , args [ 0 ] . __class__ . __name__ , f . __name__ ) ) elif ( m_args [ 0 ] == 'cls' ) : return ( '%s.%s.%s' % ( f . __module__ , args [ 0 ] . __name__ , f . __name__ ) ) if hasattr ( f , 'im_func' ) : return ( '%s.%s.%s' % ( f . __module__ , f . im_class . __name__ , f . __name__ ) ) elif hasattr ( f , '__class__' ) : return ( '%s.%s.%s' % ( f . __module__ , f . __class__ . __name__ , f . __name__ ) ) else : return ( '%s.%s' % ( f . __module__ , f . __name__ ) )
attempts to returns unique namespace for function .