def get_prefix_dict(form_dict):
    """Returns a tag prefix dictionary from a form dictionary.

    Parameters
    ----------
   form_dict: dict
        The dictionary returned from a form that contains a column prefix table
    Returns
    -------
    dict
        A dictionary whose keys names (or COLUMN_XX) and values are tag prefixes to prepend.
    """
    tag_columns = []
    prefix_dict = {}
    keys = form_dict.keys()
    for key in keys:
        if not key.startswith('column') or key.endswith('check'):
            continue
        pieces = key.split('_')
        check = 'column_' + pieces[1] + '_check'
        if form_dict.get(check, None) != 'on':
            continue
        if form_dict[key]:
            prefix_dict[int(pieces[1])] = form_dict[key]
        else:
            tag_columns.append(int(pieces[1]))
    return tag_columns, prefix_dict