<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def perimeter(patch, world_size=(60, 60), neighbor_func=get_rook_neighbors_toroidal):
 """ Count cell faces in patch that do not connect to part of patch. This preserves various square geometry features that would not be preserved by merely counting the number of cells that touch an edge. """

    edge = 0
    patch = set([tuple(i) for i in patch])
    for cell in patch:
        neighbors = neighbor_func(cell, world_size)
        neighbors = [n for n in neighbors if n not in patch]
        edge += len(neighbors)

    return edge