def file_uri(fname):
 if (os.name == 'nt'):
  if re.search('^[a-zA-Z]:', fname):
   return ('file:///' + fname)
  else:
   return ('file://' + fname)
 else:
  return ('file://' + fname)

def file_uri ( fname ) : if ( os . name == 'nt' ) : if re . search ( '^[a-zA-Z]:' , fname ) : return ( 'file:///' + fname ) else : return ( 'file://' + fname ) else : return ( 'file://' + fname )
select the right file uri scheme according to the operating system .