import copy


def remove_connected_component(cc, connected_components):
    """
    Attempt to remove connected component and return the smaller set
    :param Panel cc: connected component to remove
    :param iterable connected_components: set of all connected components
    :return: smaller set of connected components
    """
    if not isinstance(connected_components, set):
        connected_components = set(copy.deepcopy(connected_components))
    connected_components.remove(cc)
    return connected_components