str(x) if x is unicode with chars out of ascii (ąśćżłó etc) will fail (UnicodeEncodeError).