Writes data from a Collection object to JSONstat or list of \
           Pandas Dataframes.
        Args:
            output(string): can accept 'jsonstat' or 'dataframe_list'

        Returns:
            Serialized JSONstat or a list of Pandas Dataframes,depending on \
            the 'output' parameter.

def write(self, output='jsonstat'):
        """Writes data from a Collection object to JSONstat or list of \
           Pandas Dataframes.
        Args:
            output(string): can accept 'jsonstat' or 'dataframe_list'

        Returns:
            Serialized JSONstat or a list of Pandas Dataframes,depending on \
            the 'output' parameter.

        """

        if output == 'jsonstat':
            return json.dumps(self)
        elif output == 'dataframe_list':
            df_list = []
            unnest_collection(self, df_list)
            return df_list
        else:
            raise ValueError(
                "Allowed arguments are 'jsonstat' or 'dataframe_list'")