def get_item_status(item_id):
    """Method connects to ILS and retrieves the current circulation status
    of a an item.

    :param item_id: Item id, required
    :rtype: String of status
    """
    item_bot = ItemBot(opac_url=ils_settings.OPAC_URL,item_id=item_id)
    item_status = item_bot.status()
    if item_status is None:
        css_class = ''
    elif item_status.startswith('Due'):
        css_class = 'due-back'
    else:
        css_class = 'available'
    status_txt = '''<span class="%s">%s ''' % (css_class,item_status)
    volume = item_bot.volume()
    if volume is not None:
        status_txt += item_bot.volume()
    status_txt += '</span>'
    location = item_bot.location()
    if location is not None:
        if not location.startswith('Online'):
            status_txt += ' located in %s' % location
    call_number = item_bot.callnumber()
    if call_number is not None:
        status_txt += ' with call number <b>%s</b>' % call_number
    return mark_safe(status_txt) 
def get_item_status(item_id):
    """Method connects to ILS and retrieves the current circulation status
    of a an item.
    """
    item_bot = ItemBot(opac_url=ils_settings.OPAC_URL,item_id=item_id)
    item_status = item_bot.status()
    if item_status is None:
        css_class = ''
    elif item_status.startswith('Due'):
        css_class = 'due-back'
    else:
        css_class = 'available'
    status_txt = '''<span class="%s">%s ''' % (css_class,item_status)
    volume = item_bot.volume()
    if volume:
        status_txt += item_bot.volume()
    status_txt += '</span>'
    location = item_bot.location()
    if location is not None:
        if not location.startswith('Online'):
            status_txt += ' located at %s' % location
    return mark_safe(status_txt)