def _construct_location_stack_entry(location, num_traverses):
    """Return a LocationStackEntry namedtuple with the specified parameters."""
    if not isinstance(num_traverses, int) or num_traverses < 0:
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "num_traverses" {}. This is not allowed.'
                             .format(num_traverses))
    if not isinstance(location, Location):
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "location" {}. This is not allowed.'
                             .format(location))
    return LocationStackEntry(location=location, num_traverses=num_traverses)
Return a LocationStackEntry namedtuple with the specified parameters.