def computeFraction( poi_messages, all_messages ):
    """ compute the fraction of messages to/from a person that are from/to a POI """
    fraction = 0

    if poi_messages == 'NaN' or all_messages == 'NaN':
        fraction = 'NaN'
    else:
        fraction = float(poi_messages)/all_messages

    return fraction