def split_txt(txt, epub_split_size_kb=0):
 if (epub_split_size_kb > 0):
  if isinstance(txt, unicode):
   txt = txt.encode('utf-8')
  length_byte = len(txt)
  chunk_size = long((length_byte / (int((length_byte / (epub_split_size_kb * 1024))) + 2)))
  if len(filter((lambda x: (len(x) > chunk_size)), txt.split('\n\n'))):
   txt = '\n\n'.join([split_string_separator(line, chunk_size) for line in txt.split('\n\n')])
 if isbytestring(txt):
  txt = txt.decode('utf-8')
 return txt

def split_txt ( txt , epub_split_size_kb = 0 ) : if ( epub_split_size_kb > 0 ) : if isinstance ( txt , unicode ) : txt = txt . encode ( 'utf-8' ) length_byte = len ( txt ) chunk_size = long ( ( length_byte / ( int ( ( length_byte / ( epub_split_size_kb * 1024 ) ) ) + 2 ) ) ) if len ( filter ( ( lambda x : ( len ( x ) > chunk_size ) ) , txt . split ( '\n\n' ) ) ) : txt = '\n\n' . join ( [ split_string_separator ( line , chunk_size ) for line in txt . split ( '\n\n' ) ] ) if isbytestring ( txt ) : txt = txt . decode ( 'utf-8' ) return txt
ensure there are split points for converting to epub .