code: def _mk_tmp(request, factory):
      name = request.node.name
      name = re.sub(r"[\W]", "_", name)
      MAXVAL = 30
      name = name[:MAXVAL]
      return factory.mktemp(name, numbered=True)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import re
  import tempfile
  import warnings
  import attr
  import py
  import six
  import pytest
  from .pathlib import ensure_reset_dir
  from .pathlib import LOCK_TIMEOUT
  from .pathlib import make_numbered_dir
  from .pathlib import make_numbered_dir_with_cleanup
  from .pathlib import Path
  from _pytest.monkeypatch import MonkeyPatch
label_desc: Use image node_id 5 for calling a global function with example usage: _mk_tmp(request, factory) and returns: factory