def split_type_entity_id(eid, default_type_id=None):
    """
    Returns (type_id,entyity_id) pair for supplied string "type_id/entity_id".
    The supplied `eid` may be a bare "entity_id" then the supplied default 
    type_id is used.

    >>> split_type_entity_id("type_id/entity_id") == ('type_id', 'entity_id')
    True
    >>> split_type_entity_id("t/e", "f") == ('t', 'e')
    True
    >>> split_type_entity_id("entity_id", "def_type_id") == ('def_type_id', 'entity_id')
    True
    >>> split_type_entity_id(None, "def_type_id") == ('def_type_id', None)
    True
    """
    if eid is not None:
        sub_ids = eid.split("/")
        if len(sub_ids) == 2:
            return (sub_ids[0], sub_ids[1])
        if len(sub_ids) == 1:
            return (default_type_id, sub_ids[0])
        return (default_type_id, "")
    return (default_type_id, None)