Convert data into a FeatureCollection if it is not already.

def convert_to_feature_collection(self):
        """Convert data into a FeatureCollection if it is not already."""
        if self.data['type'] == 'FeatureCollection':
            return
        if not self.embed:
            raise ValueError(
                'Data is not a FeatureCollection, but it should be to apply '
                'style or highlight. Because `embed=False` it cannot be '
                'converted into one.\nEither change your geojson data to a '
                'FeatureCollection, set `embed=True` or disable styling.')
        # Catch case when GeoJSON is just a single Feature or a geometry.
        if 'geometry' not in self.data.keys():
            # Catch case when GeoJSON is just a geometry.
            self.data = {'type': 'Feature', 'geometry': self.data}
        self.data = {'type': 'FeatureCollection', 'features': [self.data]}