from typing import Iterable
from typing import AnyStr
from typing import Set


def prepare_selected_fields(fields: Iterable[AnyStr], default: Set[AnyStr]) -> Set[AnyStr]:
    """Check for selected fields of the query.

    :param fields: Iterable object with all field names that should be selected by the query
    :param default: default set of fields in case of None

    :return Set[AnyStr]: Casted names to a set object
    """

    if fields is not None:
        return set(fields)

    return default