I'm trying to make a simple, local database using Python where I can set values, get values, etc and I keep getting this error:

```
#Simple Database
#Functions include      Set[name][value]
#                       Get[name]
#                       Unset[name]
#                       Numequalto[value]
#                       End
#                       Begin, Rollback, Commit

varlist = []
ops = []
class item:
        def __init__(self,name,value):
                self.name = name
                self.value = value
class db:
    def __init__(self):
            self.varlist = []
            self.ops = []
    def Set(self,nm,val):
            changed = False                 #Bool for keeping track of update
            for item in varlist:    #run through current list
                    if item.name == nm:     #If the name is found
                            item.value = val #update the value
                            changed = True  #found it
                            break                   #exit if found
            if not changed:
                    newitem = item() #Create a new one and append it
                    newitem.name = nm
                    newitem.value = val
                    varlist.append(newitem)
    def Get(key):
            for item in varlist:
                    if item.name == key:
                            return item.value
                            break

    def Unset(key):
            for item in varlist:
                    if item.name == key:
                            item.value = -1
                            break

    def Numequalto(key):
            count = 0
            for item in varlist:
                    if item.value == key:
                            count+=1
            return count

def main():
    newdb = db()
    varlist=[]
    comm = "" #prime it
    while comm.lower() != "end":
        comm = input("Command: ")
        if comm.lower() == "begin":
            print("----SESSION START---")
            while comm.lower() != "end":
                    comm = input("Command: ")
                    part = []
                    for word in comm.split():
                            part.append(word.lower())
                    print(part)
                    if part[0].lower()=="set":
                            newdb.Set(part[1],part[2])
                            print(varlist)
                    elif part[0].lower()=="get":
                            gotten = Get(part[1])
                            print(gotten)
                    elif part[0].lower()=="unset":
                            Unset(part[1])
                    elif part[0].lower()=="numequalto":
                            numequal = Numequalto(part[1])
                            print(numequal)
            print("Finished")
        else:
            print("--ERROR: Must BEGIN--")

if __name__ == "__main__":
    main()

```

When I run this, and try to create a new item in my list using the command

```
set a 25

```

I get this error:

```
Traceback (most recent call last):
File "/Volumes/CON/LIFE/SimpleDatabase.py", line 81, in <module>
    main()
File "/Volumes/CON/LIFE/SimpleDatabase.py", line 65, in main
    newdb.Set(part[1],part[2])
File "/Volumes/CON/LIFE/SimpleDatabase.py", line 27, in Set
    newitem = item() #Create a new one and append it
UnboundLocalError: local variable 'item' referenced before assignment

```

Any help would be much appreciated. I'm pretty new to Python