@classmethod
def _get_index_type(cls, index):
    """Assigns an integer code to the type of the index.

        The index type determines how differently typed values are sorted. This ordering is based
        on https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-ordered-data
        """
    if index is None:
        return cls._type_none
    if isinstance(index, bool) and not index:
        return cls._type_bool_false
    if isinstance(index, bool) and index:
        return cls._type_bool_true
    if isinstance(index, (int, float)):
        return cls._type_numeric
    if isinstance(index, str):
        return cls._type_string
    return cls._type_object
