def handle(self, *args, **kwargs):
        # all options are required
        if not kwargs.get('file'):
            raise CommandError("You must provide a path to the csv file")
        # try open the file
        try:
            with open(kwargs.get('file'), "r") as f:
                lines = csv.reader(f)
                i = 0
                for line in lines:
                    try:
                        username = line[0]
                        id_string = line[1]
                        uuid = line[2]
                        update_xform_uuid(username, id_string, uuid)
                    except IndexError:
                        print "line %d is in an invalid format" % (i + 1)
                    except XForm.DoesNotExist:
                        print "XForm with username: %s and id string: %s does"\
                              " not exist" % (username, id_string, uuid)
                    except DuplicateUUIDError:
                        print "An xform with uuid: %s already exists" % uuid
                    else:
                        i += 1
                        print "Updated %d rows" % i
        except IOError:
            raise CommandError(
                "file %s could not be open" % kwargs.get('file'))
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/logger/management/commands/update_xform_uuids.py/Command.handle/original