code: def crop(self, bbox):
      
      skeleton = self.clone()
      bbox = Bbox.create(bbox)
  
      if skeleton.empty():
        return skeleton
  
      nodes_valid_mask = np.array(
        [ bbox.contains(vtx) for vtx in skeleton.vertices ], dtype=np.bool
      )
      nodes_valid_idx = np.where(nodes_valid_mask)[0]
  
      # Set invalid vertices to be duplicates
      # so they'll be removed during consolidation
      if nodes_valid_idx.shape[0] == 0:
        return PrecomputedSkeleton()
  
      first_node = nodes_valid_idx[0]
      skeleton.vertices[~nodes_valid_mask] = skeleton.vertices[first_node]
    
      edges_valid_mask = np.isin(skeleton.edges, nodes_valid_idx)
      edges_valid_idx = edges_valid_mask[:,0] * edges_valid_mask[:,1] 
      skeleton.edges = skeleton.edges[edges_valid_idx,:]
      return skeleton.consolidate()
docs: Crop away all vertices and edges that lie outside of the given bbox.
      The edge counts as inside.
  
      Returns: new PrecomputedSkeleton