def namespace_map(self, target):
    """Returns the namespace_map used for Thrift generation.

    :param target: The target to extract the namespace_map from.
    :type target: :class:`pants.backend.codegen.targets.java_thrift_library.JavaThriftLibrary`
    :returns: The namespaces to remap (old to new).
    :rtype: dictionary
    """
    self._check_target(target)
    return target.namespace_map or self._default_namespace_map