def get_dir(self, obj):
        """Return the dirattr of obj formatted with the dirfomat specified in the constructor.
        If the attr is None then ``None`` is returned not the string ``\'None\'``.

        :param obj: the fileinfo with information.
        :type obj: :class:`FileInfo`
        :returns: the directory or None
        :rtype: str|None
        :raises: None
        """
        if self._dirattr is None:
            return
        a = attrgetter(self._dirattr)(obj)
        if a is None:
            return
        s = self._dirformat % a
        return s