def __getStatContainer(cls, context, parent=None):
    """Get the stat container for the given context under the given parent."""
    container = parent
    if container is None:
      container = cls.stats
    if context is not None:
      context = str(context).lstrip('/')
      for key in context.split('/'):
        container.setdefault(key, StatContainer())
        container = container[key]
    return container
Get the stat container for the given context under the given parent.