<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pop_momentum_by_name(self, name):
 """Removes and returns a momentum by the given name. :param name: the momentum name. :returns: a momentum removed. :raises TypeError: `name` is ``None``. :raises KeyError: failed to find a momentum named `name`. """

        momentum = self.get_momentum_by_name(name)
        self.remove_momentum(momentum)
        return momentum