def METHOD_NAME(data):
    if not isinstance(data, bytes):
        data = data.encode()
    temp = tempfile.NamedTemporaryFile(delete=False)
    temp.write(data)
    temp.close()
    try:
        yield temp.name
    finally:
        os.unlink(temp.name)