def icon_for_field(fieldname):
    """Helper method for translating from field names to
    prototype classes"""
    if '.' in fieldname:
        fieldname = fieldname.split('.')[-1]
    default = 'icon-right-open'
    mapping = {'email': 'icon-mail', 'telephone': 'icon-phone', 'mobile':
        'icon-phone', 'address': 'icon-home', 'department': 'icon-building',
        'time_zone': 'icon-clock', 'primary_location': 'icon-globe'}
    return mapping.get(fieldname, default)
