human
Complete this python program:
def common_mocks(f):
assistant
#Here is the Python code you requested.

    """Decorator to set mocks common to all tests.
    The point of doing these mocks here is so that we don\t accidentally set
    mocks that can\t/don\t get unset.
    """
    def _common_inner_inner1(inst, *args, **kwargs):
        @mock.patch('subprocess.Popen', spec=True)
        @mock.patch('eventlet.sleep', spec=True)
        @mock.patch('time.time', spec=True)
        @mock.patch('cinder.backup.drivers.ceph.rbd')
        @mock.patch('cinder.backup.drivers.ceph.rados')
        def _common_inner_inner2(mock_rados, mock_rbd, mock_time, mock_sleep, mock_popen):
            mock_time.side_effect = inst.time_inc
            mock_popen.side_effect = Exception
            inst.mock_rados = mock_rados
            inst.mock_rbd = mock_rbd
            inst.mock_rbd.ImageBusy = MockImageBusyException
            inst.mock_rbd.ImageNotFound = MockImageNotFoundException
            inst.mock_rados.ObjectNotFound = MockObjectNotFoundException
            inst.service.rbd = inst.mock_rbd
            inst.service.rados = inst.mock_rados
            return f(inst, *args, **kwargs)
        return _common_inner_inner2()
    return _common_inner_inner1