def _modeldesc_to_dict(self, md):
        """Return a string representation of a patsy ModelDesc object"""
        d = {'lhs_termlist': [md.lhs_termlist[0].factors[0].name()]}
        rhs_termlist = []

        # add other terms, if any
        for term in md.rhs_termlist[:]:
            if len(term.factors) == 0:
                # intercept, represent by empty string
                rhs_termlist.append('')
            else:
                rhs_termlist.append(term.factors[0].name())

        d['rhs_termlist'] = rhs_termlist
        return d