<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cut_sphere( self, radius=15., origin=None, outside_sliced=True, preserve_bonds=False):
 """Cut a sphere specified by origin and radius. Args: radius (float):
 origin (list):
 Please note that you can also pass an integer. In this case it is interpreted as the index of the atom which is taken as origin. outside_sliced (bool):
 Atoms outside/inside the sphere are cut out. preserve_bonds (bool):
 Do not cut covalent bonds. Returns: Cartesian: """

        if origin is None:
            origin = np.zeros(3)
        elif pd.api.types.is_list_like(origin):
            origin = np.array(origin, dtype='f8')
        else:
            origin = self.loc[origin, ['x', 'y', 'z']]

        molecule = self.get_distance_to(origin)
        if outside_sliced:
            molecule = molecule[molecule['distance'] < radius]
        else:
            molecule = molecule[molecule['distance'] > radius]

        if preserve_bonds:
            molecule = self._preserve_bonds(molecule)

        return molecule