def create_calendar(self, data, **kwargs):
        for row in data:
            try:
                id = int(row['service_id'])
            except __HOLE__:
                print 'WARNING: Could not process service id of %s' % row
                continue

            begin, end = None, None

            if row['start_date']:
                begin = parse_date(row['start_date'])

            if row['end_date']:
                end = parse_date(row['end_date'])

            defaults = {
                'begin': begin,
                'end': end
            }

            for dow in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']:
                defaults[dow] = str(row[dow]) == '1'

            try:
                Schedule(id=id, **defaults).save()
            except:
                print 'Schedule exists'
                continue
dataset/ETHPy150Open shaunduncan/breezeminder/breezeminder/management/commands/import_marta_data.py/ImportMartaData.create_calendar