<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_all(self, locator):
 """ Removes all component references that match the specified locator. :param locator: a locator to remove reference by. :return: a list, containing all removed references. """

        components = []

        if locator == None:
            return components

        self._lock.acquire()
        try:
            for reference in reversed(self._references):
                if reference.match(locator):
                    self._references.remove(reference)
                    components.append(reference.get_component())
        finally:
            self._lock.release()
        
        return components