def import_book(stream): """Return dataset of given stream.""" (format) = detect(stream) try: databook = Databook() format.import_book(databook, stream) return databook except AttributeError: return None
def import_set(stream): """Return dataset of given stream.""" (format) = detect(stream) try: data = Dataset() format.import_set(data, stream) return data except AttributeError: return None