def get_momentum_by_name(self, name):
        """Gets a momentum by the given name.

        :param name: the momentum name.

        :returns: a momentum found.

        :raises TypeError: `name` is ``None``.
        :raises KeyError: failed to find a momentum named `name`.
        """
        if name is None:
            raise TypeError('\'name\' should not be None')
        for momentum in self.momenta:
            if momentum.name == name:
                return momentum
        raise KeyError('No such momentum named {0}'.format(name))
Gets a momentum by the given name.

        :param name: the momentum name.

        :returns: a momentum found.

        :raises TypeError: `name` is ``None``.
        :raises KeyError: failed to find a momentum named `name`.