code: def _build_xpath_expr(attrs):
      """Build an xpath expression to simulate bs4's ability to pass in kwargs to
      search for attributes when using the lxml parser.
  
      Parameters
      ----------
      attrs : dict
          A dict of HTML attributes. These are NOT checked for validity.
  
      Returns
      -------
      expr : unicode
          An XPath expression that checks for the given HTML attributes.
      """
      # give class attribute as class_ because class is a python keyword
      if "class_" in attrs:
          attrs["class"] = attrs.pop("class_")
  
      s = [
          u("@{key}={val!r}").format(key=k, val=v)
          for k, v in iteritems(attrs)
      ]
      return u("[{expr}]").format(expr=" and ".join(s))
  
imports: from distutils.version import LooseVersion
  import numbers
  import os
  import re
  import pandas.compat
  from pandas.compat import binary_type, iteritems, lmap, lrange, raise_with_traceback, string_types, u
  from pandas.errors import AbstractMethodError, EmptyDataError
  from pandas.core.dtypes.common import is_list_like
  from pandas import Series
  from pandas.io.common import _is_url, _validate_header_arg, urlopen
  from pandas.io.formats.printing import pprint_thing
  from pandas.io.parsers import TextParser
label_desc: Use image node_id 5 for calling a global function with example usage: _build_xpath_expr(attrs) and returns: u