def perimeter_of_part(partition, part):
    """
    Totals up the perimeter of the part in the partition.
    Requires that 'boundary_perim' be a node attribute, 'shared_perim' be an edge
    attribute, 'cut_edges' be an updater, and 'exterior_boundaries' be an updater.
    """
    exterior_perimeter = partition['exterior_boundaries'][part]
    interior_perimeter = partition['interior_boundaries'][part]
    return exterior_perimeter + interior_perimeter
