def get_item(name):
    "Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions.\n\n    The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy.\n        *npcs_sold and npcs_bought are list, each element is a dictionary with the keys: name, city."
    c = tibiaDatabase.cursor()
    c.execute('SELECT * FROM Items WHERE title LIKE ? ORDER BY LENGTH(title) ASC LIMIT 15', ((('%' + name) + '%'),))
    result = c.fetchall()
    if (len(result) == 0):
        return None
    elif ((result[0]['title'].lower() == name.lower()) or (len(result) == 1)):
        item = result[0]
    else:
        return [x['title'] for x in result]
    try:
        if (item is not None):
            c.execute('SELECT NPCs.title, city, value FROM Items, SellItems, NPCs WHERE Items.name LIKE ? AND SellItems.itemid = Items.id AND NPCs.id = vendorid ORDER BY value DESC', (name,))
            npcs = []
            value_sell = None
            for npc in c:
                name = npc['title']
                city = npc['city'].title()
                if (value_sell is None):
                    value_sell = npc['value']
                elif (npc['value'] != value_sell):
                    break
                if ((name == 'Alesar') or (name == 'Yaman')):
                    city = "Green Djinn's Fortress"
                    item['color'] = Colour.green()
                elif ((name == "Nah'Bob") or (name == 'Haroun')):
                    city = "Blue Djinn's Fortress"
                    item['color'] = Colour.blue()
                elif (name == 'Rashid'):
                    city = get_rashid_city()
                    item['color'] = Colour(15788310)
                elif (name == 'Yasir'):
                    city = 'his boat'
                elif (name == 'Briasol'):
                    item['color'] = Colour(11098308)
                npcs.append({'name': name, 'city': city})
            item['npcs_sold'] = npcs
            item['value_sell'] = value_sell
            c.execute('SELECT NPCs.title, city, value FROM Items, BuyItems, NPCs WHERE Items.name LIKE ? AND BuyItems.itemid = Items.id AND NPCs.id = vendorid ORDER BY value ASC', (name,))
            npcs = []
            value_buy = None
            for npc in c:
                name = npc['title']
                city = npc['city'].title()
                if (value_buy is None):
                    value_buy = npc['value']
                elif (npc['value'] != value_buy):
                    break
                if ((name == 'Alesar') or (name == 'Yaman')):
                    city = "Green Djinn's Fortress"
                elif ((name == "Nah'Bob") or (name == 'Haroun')):
                    city = "Blue Djinn's Fortress"
                elif (name == 'Rashid'):
                    offset = (get_tibia_time_zone() - get_local_timezone())
                    tibia_time = (datetime.now() + timedelta(hours=(offset - 10)))
                    city = ['Svargrond', 'Liberty Bay', 'Port Hope', 'Ankrahmun', 'Darashia', 'Edron', 'Carlin'][tibia_time.weekday()]
                elif (name == 'Yasir'):
                    city = 'his boat'
                npcs.append({'name': name, 'city': city})
            item['npcs_bought'] = npcs
            item['value_buy'] = value_buy
            c.execute('SELECT Creatures.title as name, CreatureDrops.percentage FROM CreatureDrops, Creatures WHERE CreatureDrops.creatureid = Creatures.id AND CreatureDrops.itemid = ? ORDER BY percentage DESC', (item['id'],))
            item['dropped_by'] = c.fetchall()
            c.execute('SELECT Quests.title FROM Quests, QuestRewards WHERE Quests.id = QuestRewards.questid and itemid = ?', (item['id'],))
            quests = c.fetchall()
            item['quests'] = list()
            for quest in quests:
                item['quests'].append(quest['title'])
            return item
    finally:
        c.close()
    return
Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions.

The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy.
    *npcs_sold and npcs_bought are list, each element is a dictionary with the keys: name, city.
def get_item(name):
    "Returns a dictionary containing an item's info, if no exact match was found, it returns a list of suggestions.\n\n    The dictionary has the following keys: name, look_text, npcs_sold*, value_sell, npcs_bought*, value_buy.\n        *npcs_sold and npcs_bought are list, each element is a dictionary with the keys: name, city."
    c = tibiaDatabase.cursor()
    c.execute('SELECT * FROM Items WHERE title LIKE ? ORDER BY LENGTH(title) ASC LIMIT 15', ((('%' + name) + '%'),))
    result = c.fetchall()
    if (len(result) == 0):
        return None
    elif ((result[0]['title'].lower() == name.lower()) or (len(result) == 1)):
        item = result[0]
    else:
        return [x['title'] for x in result]
    try:
        if (item is not None):
            c.execute('SELECT NPCs.title, city, value FROM Items, SellItems, NPCs WHERE Items.name LIKE ? AND SellItems.itemid = Items.id AND NPCs.id = vendorid ORDER BY value DESC', (name,))
            npcs = []
            value_sell = None
            for npc in c:
                name = npc['title']
                city = npc['city'].title()
                if (value_sell is None):
                    value_sell = npc['value']
                elif (npc['value'] != value_sell):
                    break
                if ((name == 'Alesar') or (name == 'Yaman')):
                    city = "Green Djinn's Fortress"
                    item['color'] = Colour.green()
                elif ((name == "Nah'Bob") or (name == 'Haroun')):
                    city = "Blue Djinn's Fortress"
                    item['color'] = Colour.blue()
                elif (name == 'Rashid'):
                    city = get_rashid_city()
                    item['color'] = Colour(15788310)
                elif (name == 'Yasir'):
                    city = 'his boat'
                elif (name == 'Briasol'):
                    item['color'] = Colour(11098308)
                npcs.append({'name': name, 'city': city})
            item['npcs_sold'] = npcs
            item['value_sell'] = value_sell
            c.execute('SELECT NPCs.title, city, value FROM Items, BuyItems, NPCs WHERE Items.name LIKE ? AND BuyItems.itemid = Items.id AND NPCs.id = vendorid ORDER BY value ASC', (name,))
            npcs = []
            value_buy = None
            for npc in c:
                name = npc['title']
                city = npc['city'].title()
                if (value_buy is None):
                    value_buy = npc['value']
                elif (npc['value'] != value_buy):
                    break
                if ((name == 'Alesar') or (name == 'Yaman')):
                    city = "Green Djinn's Fortress"
                elif ((name == "Nah'Bob") or (name == 'Haroun')):
                    city = "Blue Djinn's Fortress"
                elif (name == 'Rashid'):
                    offset = (get_tibia_time_zone() - get_local_timezone())
                    tibia_time = (datetime.now() + timedelta(hours=(offset - 10)))
                    city = ['Svargrond', 'Liberty Bay', 'Port Hope', 'Ankrahmun', 'Darashia', 'Edron', 'Carlin'][tibia_time.weekday()]
                elif (name == 'Yasir'):
                    city = 'his boat'
                npcs.append({'name': name, 'city': city})
            item['npcs_bought'] = npcs
            item['value_buy'] = value_buy
            c.execute('SELECT Creatures.title as name, CreatureDrops.percentage FROM CreatureDrops, Creatures WHERE CreatureDrops.creatureid = Creatures.id AND CreatureDrops.itemid = ? ORDER BY percentage DESC', (item['id'],))
            item['dropped_by'] = c.fetchall()
            c.execute('SELECT Quests.title FROM Quests, QuestRewards WHERE Quests.id = QuestRewards.questid and itemid = ?', (item['id'],))
            quests = c.fetchall()
            item['quests'] = list()
            for quest in quests:
                item['quests'].append(quest['title'])
            return item
    finally:
        c.close()
    return