<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pack_paths(paths, sheet_size=None):
 """ Pack a list of Path2D objects into a rectangle. Parameters paths: (n,) Path2D Geometry to be packed Returns packed : trimesh.path.Path2D Object containing input geometry inserted : (m,) int Indexes of paths inserted into result """

    from .util import concatenate

    if sheet_size is not None:
        sheet_size = np.sort(sheet_size)[::-1]

    quantity = []
    for path in paths:
        if 'quantity' in path.metadata:
            quantity.append(path.metadata['quantity'])
        else:
            quantity.append(1)

    # pack using exterior polygon (will OBB)
    polygons = [i.polygons_closed[i.root[0]] for i in paths]

    # pack the polygons using rectangular bin packing
    inserted, transforms = multipack(polygons=polygons,
                                     quantity=quantity,
                                     sheet_size=sheet_size)

    multi = []
    for i, T in zip(inserted, transforms):
        multi.append(paths[i].copy())
        multi[-1].apply_transform(T)

    # append all packed paths into a single Path object
    packed = concatenate(multi)

    return packed, inserted