'Get autocomplete data for an item\'s tags.'

@web.expose
@web.require_login("get    autocomplete    data    for    an    item's    tags")
def tag_autocomplete_data(self, trans, q=None, limit=None, timestamp=None, item_id=None, item_class=None):

    item = None
    if (item_id is not None):
        item = self._get_item(trans, item_class, trans.security.decode_id(item_id))
    user = trans.user
    item_class = self.get_class(item_class)
    q = ('' if (q is None) else q)
    q = q.encode('utf-8')
    if (q.find(':') == (-1)):
        return self._get_tag_autocomplete_names(trans, q, limit, timestamp, user, item, item_class)
    else:
        return self._get_tag_autocomplete_values(trans, q, limit, timestamp, user, item, item_class)
