<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_formula_class(self, formula):
 """ get a formula class object if it exists, else create one, add it to the dict, and pass return it. """

        # recursive import otherwise
        from sprinter.formula.base import FormulaBase
        if formula in LEGACY_MAPPINGS:
            formula = LEGACY_MAPPINGS[formula]
        formula_class, formula_url = formula, None
        if ':' in formula:
            formula_class, formula_url = formula.split(":", 1)
        if formula_class not in self._formula_dict:
            try:
                self._formula_dict[formula_class] = lib.get_subclass_from_module(formula_class, FormulaBase)
            except (SprinterException, ImportError):
                logger.info("Downloading %s..." % formula_class)
                try:
                    self._pip.install_egg(formula_url or formula_class)
                    try:
                        self._formula_dict[formula_class] = lib.get_subclass_from_module(formula_class, FormulaBase)
                    except ImportError:
                        logger.debug("FeatureDict import Error", exc_info=sys.exc_info())
                        raise SprinterException("Error: Unable to retrieve formula %s!" % formula_class)
                except PipException:
                    logger.error("ERROR: Unable to download %s!" % formula_class)
        return self._formula_dict[formula_class]