<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def start_building (self, main_target_instance):
 """ Helper rules to detect cycles in main target references. """

        assert isinstance(main_target_instance, MainTarget)
        if id(main_target_instance) in self.targets_being_built_:
            names = []
            for t in self.targets_being_built_.values() + [main_target_instance]:
                names.append (t.full_name())

            get_manager().errors()("Recursion in main target references\n")

        self.targets_being_built_[id(main_target_instance)] = main_target_instance