<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def keep_form_with_max_profit(self, forms=None):
 """ This converts the dataframe, which shows all profitable forms, to the form with the greatest profit, so that more profitable forms outcompete less profitable forms. Parameters forms: list of strings List of forms which compete which other. Can leave some out. Returns ------- Nothing. Goes from a multi-index to a single index with only the most profitable form. """

        f = self.feasibility

        if forms is not None:
            f = f[forms]

        if len(f) > 0:
            mu = self._max_form(f, "max_profit")
            indexes = [tuple(x) for x in mu.reset_index().values]
        else:
            indexes = []
        df = f.stack(level=0).loc[indexes]
        df.index.names = ["parcel_id", "form"]
        df = df.reset_index(level=1)
        return df