How does the second law of thermodynamics forbid the possibility of perpetual machine of the second kind? Fermi in his lecture asserts:

The second law of thermodynamics rules out the possibility of constructing a perpetuum mobile of the second kind.

So, this means there can be no machine which just transforms all the heat energy gained by cooling surrounding bodies into mechanical work.
But how does actually the Second Law prohibit this? 
The hot reservoir provides heat energy to the system. Does it cause a decrease in entropy of the universe(system + hot reservoir)? How? In order to receive heat wouldn't the system have to be cooler than the reservoir? If so, then entropy increases as the heat energy gets expelled from the reservoir at a higher temperature than the temperature the system receives the heat energy. Is it so?
I'm not getting how the Second Law nullifies the existence of this machine. Could anyone please explain how the Law prohibits the perpetual machine of the second kind?
 A: Suppose you have a heat reservoir at $300\,\mathrm{K}$, and you take $9.8\,\mathrm{J}$ of energy out of it to lift a $1\,\mathrm{kg}$ weight $1\,\mathrm{m}$ off the ground. Then the entropy of the heat reservoir has been reduced by $9.8/300 = 0.33\,\mathrm{JK^{-1}}$, but the entropy of the weight is unchanged, since it has only moved and not changed state. So the total entropy change is $-0.33\,\mathrm{JK^{-1}}$, which is negative, so this would violate the second law.
A: I might see part of the problem here. There are processes in which energy is extracted via heating from a thermal reservoir, and in the process the system does positive work on the environment, and all of the energy coming in via  heating gets transformed into work. There are many canonical examples in classic thermodynamics: the main one is an ideal gas undergoing an isothermal expansion.
So when you say

The hot reservoir provides heat energy to the system. Does it cause a decrease in entropy of the universe(system + hot reservoir)? How? In order to receive heat wouldn't the system have to be cooler than the reservoir? If so, then entropy increases as the heat energy gets expelled from the reservoir at a higher temperature than the temperature the system receives the heat energy. Is it so?

you are correct. This doesn't violate the Second Law at all, for the reasons you have expounded: either the system and the reservoir have the same temperature while they are exchanging energy via heat---in which case the net change in entropy is zero---or the system has a smaller temperature, in which case it is straight-forward to show that the system entropy increases more than the reservoir entropy decreases.

So what is the actual statement of the Second Law here? It is this:

It is impossible to construct an engine which will work in a complete cycle, and produce no effect except the raising of a weight and cooling of a heat reservoir.

The operative word there is "cycle": if the system has to operate on a cycle, then the entropy increase of the system caused by heat flow from the hot thermal reservoir must be offset by an entropy decrease, as I explain in this answer. This means that the system must expel energy via heating to a cold thermal reservoir, and that is exactly the reason why a perpetual motion machine doesn't exist: some of the energy must be wasted.
This is what people talk about when they talk about perpetual motion machines of the second kind: in order to have "perpetual motion", the system must repeat its motion over and over and over again, forever. In the processes I discussed above where all of the heat is converted into work, the system doesn't reset (it doesn't operate on a cycle!), and so such a machine must eventually stop. On the other hand, if the system does reset (i.e. if it does operate on a cycle), then some of the available energy is wasted every cycle, and so eventually again, the machine must run down and eventually stop.
