# Path: crossword/core.py
# class Crossword(object):
# 
#     IPUZ = "ipuz"
# 
#     PUZ = "puz"
# 
#     def __init__(self, width=15, height=15):
#         if width <= 0:
#             raise ValueError("Width needs to be at least one")
#         if height <= 0:
#             raise ValueError("Height needs to be at least one")
#         self.width = width
#         self.height = height
#         self._data = [
#             [CrosswordCell() for _ in range(width)] for _ in range(height)
#         ]
#         self.meta = CrosswordMetadata()
#         self.clues = CrosswordClues()
#         self._format_identifier = None  # file format-specific identifier
#         self._format = {}  # file format-specific data
#         self.block = None
#         self.empty = None
# 
#     @property
#     def cells(self):
#         for y in range(self.height):
#             for x in range(self.width):
#                 yield x, y
# 
#     @property
#     def content(self):
#         return {
#             'width': self.width,
#             'height': self.height,
#             'cells': self._data,
#             'metadata': self.meta,
#             'clues': {
#                 'across': self.clues.across,
#                 'down': self.clues.down,
#             },
#             'block': self.block,
#             'empty': self.empty,
#             'type': self._format_identifier,
#             'format': self._format,
#         }
# 
#     def __getitem__(self, index):
#         if isinstance(index, tuple):
#             x, y = index
#             if not (0 <= x < self.width):
#                 raise IndexError("Invalid cell coordinates: {}".format(index))
#             if not (0 <= y < self.height):
#                 raise IndexError("Invalid cell coordinates: {}".format(index))
#             return self._data[y][x]
#         if not (0 <= index < self.height):
#             raise IndexError("Invalid row coordinate: {}".format(index))
#         return self._data[index]
# 
#     def __setitem__(self, index, value):
#         x, y = index
#         if isinstance(value, basestring):
#             value = {'cell': value}
#         if not isinstance(value, CrosswordCell):
#             value = CrosswordCell(value)
#         self._data[y][x] = value
# 
#     def __str__(self):
#         result = []
#         for row in self:
#             for cell in row:
#                 result.append(str(cell if cell else ' '))
#             result.append(str(os.linesep))
#         return str('').join(result)
# 
# class CrosswordCell(dict):
# 
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError
# 
#     def __setattr__(self, name, value):
#         self[name] = value
# 
# Path: crossword/exceptions.py
# class CrosswordException(Exception):
#     pass


from crossword.core import Crossword, CrosswordCell
from crossword.exceptions import CrosswordException
    if crossword.meta.creator is not None:
        ipuz_dict["author"] = crossword.meta.creator
    if crossword.meta.rights is not None:
        ipuz_dict["copyright"] = crossword.meta.rights
    if crossword.meta.date is not None:
        ipuz_dict["date"] = crossword.meta.date
    if crossword.meta.contributor is not None:
        ipuz_dict["editor"] = crossword.meta.contributor
    if crossword.meta.description is not None:
        ipuz_dict["notes"] = crossword.meta.description
    if crossword.meta.publisher is not None:
        ipuz_dict["publisher"] = crossword.meta.publisher
    if crossword.meta.identifier is not None:
        ipuz_dict["uniqueid"] = crossword.meta.identifier
    if crossword.meta.title is not None:
        ipuz_dict["title"] = crossword.meta.title
    if crossword.block is not None:
        ipuz_dict["block"] = crossword.block
    if crossword.empty is not None:
        ipuz_dict["empty"] = crossword.empty

    across_clues = [list(item) for item in crossword.clues.across()]
    down_clues = [list(item) for item in crossword.clues.down()]
    if across_clues or down_clues:
        ipuz_dict["clues"] = {}
        if across_clues:
            ipuz_dict["clues"]['Across'] = across_clues
        if down_clues:
            ipuz_dict["clues"]['Down'] = down_clues


# Path: crossword/core.py
# class Crossword(object):
# 
#     IPUZ = "ipuz"
# 
#     PUZ = "puz"
# 
#     def __init__(self, width=15, height=15):
#         if width <= 0:
#             raise ValueError("Width needs to be at least one")
#         if height <= 0:
#             raise ValueError("Height needs to be at least one")
#         self.width = width
#         self.height = height
#         self._data = [
#             [CrosswordCell() for _ in range(width)] for _ in range(height)
#         ]
#         self.meta = CrosswordMetadata()
#         self.clues = CrosswordClues()
#         self._format_identifier = None  # file format-specific identifier
#         self._format = {}  # file format-specific data
#         self.block = None
#         self.empty = None
# 
#     @property
#     def cells(self):
#         for y in range(self.height):
#             for x in range(self.width):
#                 yield x, y
# 
#     @property
#     def content(self):
#         return {
#             'width': self.width,
#             'height': self.height,
#             'cells': self._data,
#             'metadata': self.meta,
#             'clues': {
#                 'across': self.clues.across,
#                 'down': self.clues.down,
#             },
#             'block': self.block,
#             'empty': self.empty,
#             'type': self._format_identifier,
#             'format': self._format,
#         }
# 
#     def __getitem__(self, index):
#         if isinstance(index, tuple):
#             x, y = index
#             if not (0 <= x < self.width):
#                 raise IndexError("Invalid cell coordinates: {}".format(index))
#             if not (0 <= y < self.height):
#                 raise IndexError("Invalid cell coordinates: {}".format(index))
#             return self._data[y][x]
#         if not (0 <= index < self.height):
#             raise IndexError("Invalid row coordinate: {}".format(index))
#         return self._data[index]
# 
#     def __setitem__(self, index, value):
#         x, y = index
#         if isinstance(value, basestring):
#             value = {'cell': value}
#         if not isinstance(value, CrosswordCell):
#             value = CrosswordCell(value)
#         self._data[y][x] = value
# 
#     def __str__(self):
#         result = []
#         for row in self:
#             for cell in row:
#                 result.append(str(cell if cell else ' '))
#             result.append(str(os.linesep))
#         return str('').join(result)
# 
# class CrosswordCell(dict):
# 
#     def __getattr__(self, name):
#         try:
#             return self[name]
#         except KeyError:
#             raise AttributeError
# 
#     def __setattr__(self, name, value):
#         self[name] = value
# 
# Path: crossword/exceptions.py
# class CrosswordException(Exception):
#     pass


# Path: crossword/format_ipuz.py
from crossword.core import Crossword, CrosswordCell
from crossword.exceptions import CrosswordException

    if crossword.meta.creator is not None:
        ipuz_dict["author"] = crossword.meta.creator
    if crossword.meta.rights is not None:
        ipuz_dict["copyright"] = crossword.meta.rights
    if crossword.meta.date is not None:
        ipuz_dict["date"] = crossword.meta.date
    if crossword.meta.contributor is not None:
        ipuz_dict["editor"] = crossword.meta.contributor
    if crossword.meta.description is not None:
        ipuz_dict["notes"] = crossword.meta.description
    if crossword.meta.publisher is not None:
        ipuz_dict["publisher"] = crossword.meta.publisher
    if crossword.meta.identifier is not None:
        ipuz_dict["uniqueid"] = crossword.meta.identifier
    if crossword.meta.title is not None:
        ipuz_dict["title"] = crossword.meta.title
    if crossword.block is not None:
        ipuz_dict["block"] = crossword.block
    if crossword.empty is not None:
        ipuz_dict["empty"] = crossword.empty

    across_clues = [list(item) for item in crossword.clues.across()]
    down_clues = [list(item) for item in crossword.clues.down()]
    if across_clues or down_clues:
        ipuz_dict["clues"] = {}
        if across_clues:
            ipuz_dict["clues"]['Across'] = across_clues
        if down_clues:
            ipuz_dict["clues"]['Down'] = down_clues


    if crossword._format_identifier == Crossword.IPUZ: