code: def utf8(value):
      # type: (typing.Union[bytes,unicode_type,None])->typing.Union[bytes,None]
      """Converts a string argument to a byte string.
  
      If the argument is already a byte string or None, it is returned unchanged.
      Otherwise it must be a unicode string and is encoded as utf8.
      """
      if isinstance(value, _UTF8_TYPES):
          return value
      if not isinstance(value, unicode_type):
          raise TypeError(
              "Expected bytes, unicode, or None; got %r" % type(value)
          )
      return value.encode("utf-8")
  
file_path: catboost/contrib/python/tornado/tornado-4/tornado/escape.py
imports: from __future__ import absolute_import, division, print_function
  import json
  import re
  from tornado.util import PY3, unicode_type, basestring_type
label_desc: Use image node_id 7 for calling a global function with example usage: utf8(value) and returns: value, value