@staticmethod
def calc_map_types_split_index(types_string):
    """ Returns the index of the comma separating the key and value types in a map type.

        :param types_string: the string declaring the map's type.
        :returns: index of top-level separating comma
        :rtype: int

        """
    bracket_depth = 0
    for i, char in enumerate(types_string):
        if char == '<':
            bracket_depth += 1
        elif char == '>':
            bracket_depth -= 1
        elif char == ',' and bracket_depth == 0:
            return i
    return -1
