def autolink_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]):
 env = inliner.document.settings.env
 r = env.get_domain('py').role('obj')('obj', rawtext, etext, lineno, inliner, options, content)
 pnode = r[0][0]
 prefixes = get_import_prefixes_from_env(env)
 try:
  (name, obj, parent) = import_by_name(pnode['reftarget'], prefixes)
 except ImportError:
  content = pnode[0]
  r[0][0] = nodes.emphasis(rawtext, content[0].astext(), classes=content['classes'])
 return r

def autolink_role ( typ , rawtext , etext , lineno , inliner , options = { } , content = [ ] ) : env = inliner . document . settings . env r = env . get_domain ( 'py' ) . role ( 'obj' ) ( 'obj' , rawtext , etext , lineno , inliner , options , content ) pnode = r [ 0 ] [ 0 ] prefixes = get_import_prefixes_from_env ( env ) try : ( name , obj , parent ) = import_by_name ( pnode [ 'reftarget' ] , prefixes ) except ImportError : content = pnode [ 0 ] r [ 0 ] [ 0 ] = nodes . emphasis ( rawtext , content [ 0 ] . astext ( ) , classes = content [ 'classes' ] ) return r
smart linking role .