def write_jcamp_pair(f, key, value):
    """
    Write out a line of a JCAMP file.

    a line might actually be more than one line of text for arrays.
    """
    line = '##$' + key + '= '
    if type(value) == float or type(value) == int:
        line = line + repr(value)
    elif isinstance(value, str):
        line = line + '<' + value + '>'
    elif type(value) == bool:
        if value:
            line = line + 'yes'
        else:
            line = line + 'no'
    elif isinstance(value, list):
        line = line + '(0..' + repr(len(value) - 1) + ')'
        f.write(line)
        f.write('\n')
        line = ''
        for v in value:
            if len(line) > 70:
                f.write(line)
                f.write('\n')
                line = ''
            if isinstance(v, str):
                to_add = '<' + v + '>'
            else:
                to_add = repr(v)
            if len(line + ' ' + to_add) > 80:
                f.write(line)
                f.write('\n')
                line = ''
            if line != '':
                line = line + to_add + ' '
            else:
                line = to_add + ' '
    f.write(line)
    f.write('\n')
    return
