def _build_xpath_expr(attrs):
 if ('class_' in attrs):
  attrs['class'] = attrs.pop('class_')
 s = [(u('@%s=%r') % (k, v)) for (k, v) in iteritems(attrs)]
 return (u('[%s]') % ' and '.join(s))

def _build_xpath_expr ( attrs ) : if ( 'class_' in attrs ) : attrs [ 'class' ] = attrs . pop ( 'class_' ) s = [ ( u ( '@%s=%r' ) % ( k , v ) ) for ( k , v ) in iteritems ( attrs ) ] return ( u ( '[%s]' ) % ' and ' . join ( s ) )
build an xpath expression to simulate bs4s ability to pass in kwargs to search for attributes when using the lxml parser .