make dit.utils.misc.flatten work on py3