Update serialize.py

double time imported

import datetime imported but unused

and fix PEP8 style