returns string from contract tuple

def contractString(self, contract, seperator="_"):
        """ returns string from contract tuple """

        localSymbol = ""
        contractTuple = contract

        if type(contract) != tuple:
            localSymbol = contract.m_localSymbol
            contractTuple = self.contract_to_tuple(contract)

        # build identifier
        try:
            if contractTuple[1] in ("OPT", "FOP"):
                # if contractTuple[5]*100 - int(contractTuple[5]*100):
                #     strike = contractTuple[5]
                # else:
                #     strike = "{0:.2f}".format(contractTuple[5])
                strike = '{:0>5d}'.format(int(contractTuple[5])) + \
                    format(contractTuple[5], '.3f').split('.')[1]

                contractString = (contractTuple[0] + str(contractTuple[4]) +
                                  contractTuple[6][0] + strike, contractTuple[1])
                                  # contractTuple[6], str(strike).replace(".", ""))

            elif contractTuple[1] == "FUT":
                exp = ' ' # default

                # round expiry day to expiry month
                if localSymbol != "":
                    # exp = localSymbol[2:3]+str(contractTuple[4][:4])
                    exp = localSymbol[2:3] + self.localSymbolExpiry[localSymbol][:4]

                if ' ' in exp:
                    exp = str(contractTuple[4])[:6]
                    exp = dataTypes["MONTH_CODES"][int(exp[4:6])] + str(int(exp[:4]))

                contractString = (contractTuple[0] + exp, contractTuple[1])

            elif contractTuple[1] == "CASH":
                contractString = (contractTuple[0] + contractTuple[3], contractTuple[1])

            else:  # STK
                contractString = (contractTuple[0], contractTuple[1])

            # construct string
            contractString = seperator.join(
                str(v) for v in contractString).replace(seperator + "STK", "")

        except Exception:
            contractString = contractTuple[0]

        return contractString.replace(" ", "_").upper()