<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _create_path(entities, vertices, metadata=None, **kwargs):
 """ Turn entities and vertices into a Path2D or a Path3D object depending on dimension of vertices. Parameters entities : list Entity objects that reference vertex indices vertices : (n, 2) or (n, 3) float Vertices in space metadata : dict Any metadata about the path object Returns as_path : Path2D or Path3D object Args in native trimesh object form """

    # make sure vertices are numpy array
    vertices = np.asanyarray(vertices, dtype=np.float64)

    # check dimension of vertices to decide on object type
    if vertices.shape[1] == 2:
        path_type = Path2D
    elif vertices.shape[1] == 3:
        path_type = Path3D
    else:
        # weird or empty vertices, just use default Path object
        path_type = Path

    # create the object
    as_path = path_type(entities=entities,
                        vertices=vertices,
                        metadata=metadata,
                        **kwargs)
    return as_path