'Loads a template.  This method looks up the template in the cache
or loads one by calling :meth:`get_source`.  Subclasses should not
override this method as loaders working on collections of other
loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`)
will not call this method but `get_source` directly.'

@internalcode
def load(self, environment, name, globals=None):

    code = None
    if (globals is None):
        globals = {}
    (source, filename, uptodate) = self.get_source(environment, name)
    bcc = environment.bytecode_cache
    if (bcc is not None):
        bucket = bcc.get_bucket(environment, name, filename, source)
        code = bucket.code
    if (code is None):
        code = environment.compile(source, name, filename)
    if ((bcc is not None) and (bucket.code is None)):
        bucket.code = code
        bcc.set_bucket(bucket)
    return environment.template_class.from_code(environment, code, globals, uptodate)
