<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def snap_momentum_by_name(self, name, velocity, at=None):
 """Changes the velocity of a momentum named `name`. :param name: the momentum name. :param velocity: a new velocity. :param at: the time to snap. (default: now) :returns: a momentum updated. :raises TypeError: `name` is ``None``. :raises KeyError: failed to find a momentum named `name`. """

        at = now_or(at)
        self.forget_past(at=at)
        return self.update_momentum_by_name(name, velocity=velocity, since=at)