<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_profile_class(name):
 """For the given profile name, load the data from the external database, then generate dynamically a class. """

    if name not in CLASS_CACHE:
        profile_data = PROFILES[name]
        profile_name = clean(name)
        class_name = '{}{}Profile'.format(
            profile_name[0].upper(), profile_name[1:])
        new_class = type(class_name, (BaseProfile,), {'profile_data': profile_data})
        CLASS_CACHE[name] = new_class

    return CLASS_CACHE[name]