def split_tag_type(tag):
    """Extracts and returns the tag and tag type.
    """

    split_tag = tag.split('-')
    if len(split_tag) > 2 or len(split_tag) == 0:
        raise ValueError('tag format wrong. it must be B-xxx.xxx')
    if len(split_tag) == 1:
        tag = split_tag[0]
        tag_type = ""
    else:
        tag = split_tag[0]
        tag_type = split_tag[1]
    return tag, tag_type