<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getGenerator(cls, locale=None, providers=None, codename=None):
 """ use a codename to cache generators """


        codename = codename or cls.getCodename(locale, providers)

        if codename not in cls.generators:
            from faker import Faker as FakerGenerator
            # initialize with faker.generator.Generator instance
            # and remember in cache
            cls.generators[codename] = FakerGenerator( locale, providers )
            cls.generators[codename].seed( cls.generators[codename].randomInt() )

        return cls.generators[codename]