def METHOD_NAME(self, name):
    """
    If the name represents a directory, return that name
    as a directory (with the trailing slash).
    """
    names = self._name_set()
    dirname = name + '/'
    dir_match = name not in names and dirname in names
    return dirname if dir_match else name