<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean(self, *args, **kwargs):
 """ Custom validation 1. interface_a and interface_b mandatory except for planned links 2. planned links should have at least node_a and node_b filled in 3. dbm and noise fields can be filled only for radio links 4. interface_a and interface_b must differ 5. interface a and b type must match """

        if self.status != LINK_STATUS.get('planned'):
            if self.interface_a is None or self.interface_b is None:
                raise ValidationError(_('fields "from interface" and "to interface" are mandatory in this case'))

            if (self.interface_a_id == self.interface_b_id) or (self.interface_a == self.interface_b):
                msg = _('link cannot have same "from interface" and "to interface: %s"') % self.interface_a
                raise ValidationError(msg)

        if self.status == LINK_STATUS.get('planned') and (self.node_a is None or self.node_b is None):
            raise ValidationError(_('fields "from node" and "to node" are mandatory for planned links'))

        if self.type != LINK_TYPES.get('radio') and (self.dbm is not None or self.noise is not None):
            raise ValidationError(_('Only links of type "radio" can contain "dbm" and "noise" information'))