Convert the Wharton GSR format into the studyspaces API format.

def switch_format(self, gsr):
        """ Convert the Wharton GSR format into the studyspaces API format. """
        if "error" in gsr:
            return gsr
        categories = {
            "cid": 1,
            "name": "Huntsman Hall",
            "rooms": []
        }

        for time in gsr["times"]:
            for entry in time:
                entry["name"] = entry["room_number"]
                del entry["room_number"]
                start_time_str = entry["start_time"]
                end_time = datetime.datetime.strptime(start_time_str[:-6], '%Y-%m-%dT%H:%M:%S') + datetime.timedelta(minutes=30)
                end_time_str = end_time.strftime("%Y-%m-%dT%H:%M:%S") + "-{}".format(self.get_dst_gmt_timezone())
                time = {
                    "available": not entry["reserved"],
                    "start": entry["start_time"],
                    "end": end_time_str,
                }
                exists = False
                for room in categories["rooms"]:
                    if room["name"] == entry["name"]:
                        room["times"].append(time)
                        exists = True
                if not exists:
                    del entry["booked_by_user"]
                    del entry["building"]
                    if "reservation_id" in entry:
                        del entry["reservation_id"]
                    entry["lid"] = 1
                    entry["gid"] = 1
                    entry["capacity"] = 5
                    entry["room_id"] = int(entry["id"])
                    del entry["id"]
                    entry["times"] = [time]
                    del entry["reserved"]
                    del entry["end_time"]
                    del entry["start_time"]
                    categories["rooms"].append(entry)
        return {"categories": [categories], "rooms": categories["rooms"]}