def var_text(vname, iotype, variable):
    """
    Extract info from variable for vname of iotype
    and return info as HTML string.
    """
    if iotype == 'read':
        txt = '<p><i>Input Variable Name:</i> <b>{}</b>'.format(vname)
        if 'required' in variable:
            txt += '<br><b><i>Required Input Variable</i></b>'
    else:
        txt = '<p><i>Output Variable Name:</i> <b>{}</b>'.format(vname)
    txt += '<br><i>Description:</i> {}'.format(variable['desc'])
    txt += '<br><i>Datatype:</i> {}'.format(variable['type'])
    if iotype == 'read':
        txt += '<br><i>Availability:</i> {}'.format(variable['availability'])
    txt += '<br><i>IRS Form Location:</i>'
    formdict = variable['form']
    for yrange in sorted(formdict.keys()):
        txt += '<br>{}: {}'.format(yrange, formdict[yrange])
    txt += '</p>'
    return txt