def make_tempfile(data=None):
    with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp:
        temp.write(six.text_type(data if data is not None else os.getpid()))
        return temp.name
Create a temp file, write our PID into it.
dataset/ETHPy150Open smartfile/django-transfer/django_transfer/views.py/make_tempfile