Fix compatibility with pypy

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>