<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get(self, name, typ):
 """ Gets a counter specified by its name. It counter does not exist or its type doesn't match the specified type it creates a new one. :param name: a counter name to retrieve. :param typ: a counter type. :return: an existing or newly created counter of the specified type. """

        if name == None or len(name) == 0:
            raise Exception("Counter name was not set")

        self._lock.acquire()
        try:
            counter = self._cache[name] if name in self._cache else None

            if counter == None or counter.type != typ:
                counter = Counter(name, typ)
                self._cache[name] = counter

            return counter
        finally:
            self._lock.release()