hacky as hell j2py conversion. May or may not have worked