def remove(self, locator):
        """
        Removes a previously added reference that matches specified locator.
        If many references match the locator, it removes only the first one.
        When all references shall be removed, use [[removeAll]] method instead.

        :param locator: a locator to remove reference

        :return: the removed component reference.
        """
        if locator == None:
            return None

        self._lock.acquire()
        try:
            for reference in reversed(self._references):
                if reference.match(locator):
                    self._references.remove(reference)
                    return reference.get_component()
        finally:
            self._lock.release()
        
        return None
def remove ( self , locator ) : if locator == None : return None self . _lock . acquire ( ) try : for reference in reversed ( self . _references ) : if reference . match ( locator ) : self . _references . remove ( reference ) return reference . get_component ( ) finally : self . _lock . release ( ) return None
Removes a previously added reference that matches specified locator.
        If many references match the locator, it removes only the first one.
        When all references shall be removed, use [[removeAll]] method instead.

        :param locator: a locator to remove reference

        :return: the removed component reference.