code: def split_stock_str(stock_str_param):
      
      stock_str = str(stock_str_param)
  
      split_loc = stock_str.find(".")
      '''do not use the built-in split function in python.
      The built-in function cannot handle some stock strings correctly.
      for instance, US..DJI, where the dot . itself is a part of original code'''
      if 0 <= split_loc < len(
              stock_str) - 1 and stock_str[0:split_loc] in MKT_MAP:
          market_str = stock_str[0:split_loc]
          market_code = MKT_MAP[market_str]
          partial_stock_str = stock_str[split_loc + 1:]
          return RET_OK, (market_code, partial_stock_str)
  
      else:
          error_str = ERROR_STR_PREFIX + "format of %s is wrong. (US.AAPL, HK.00700, SZ.000001)" % stock_str
          return RET_ERROR, error_str
docs: split the stock string