<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tickerId(self, contract_identifier):
 """ returns the tickerId for the symbol or sets one if it doesn't exits """

        # contract passed instead of symbol?
        symbol = contract_identifier
        if isinstance(symbol, Contract):
            symbol = self.contractString(symbol)

        for tickerId in self.tickerIds:
            if symbol == self.tickerIds[tickerId]:
                return tickerId
        else:
            tickerId = len(self.tickerIds)
            self.tickerIds[tickerId] = symbol
            return tickerId