@classmethod
    def get_data_as_csv(cls, slug, timestamp):
        csv_buffer = StringIO()
        file_name = cls.get_file_name(slug, timestamp)

        keys = MetricsSession.keys
        try:
            with open(file_name, 'r') as f:
                session_data = json.load(f)
                rows = session_data['entries']
        except __HOLE__:
            return None
        else:
            writer = csv.DictWriter(csv_buffer, keys)
            writer.writerow(dict(zip(keys, keys)))
            for row in rows:
                writer.writerow(row)

            csv_data = csv_buffer.getvalue()
            csv_buffer.close()

            return csv_data
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/models/metrics.py/MetricsSession.get_data_as_csv