def METHOD_NAME(count):
    namespace = {}
    METHOD_NAME = "def foo():\n " + "".join(["\n "] * count + ["spam\n"])
    exec_fn = six.__dict__["exec_"]
    exec_fn(METHOD_NAME, namespace)
    return namespace["foo"]