<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def with_relation(self, relation_name=None):
 """ if relation is not None, when fetch manytomany result, also fetch relation record and saved them to manytomany object, and named them as relation. If relation_name is not given, then default value is 'relation' """

        if not relation_name:
            relation_name = 'relation'
        if hasattr(self.modelb, relation_name):
            raise Error("The attribute name %s has already existed in Model %s!" % (relation_name, self.modelb.__name__))
        if not self.through_model:
            raise Error("Only with through style in ManyToMany supports with_relation function of Model %s!" % self.modelb.__name__)
        self.with_relation_name = relation_name
        return self