def _find_x12(x12path=None, prefer_x13=True):
 global _binary_names
 if ((x12path is not None) and x12path.endswith(_binary_names)):
  x12path = os.path.dirname(x12path)
 if (not prefer_x13):
  _binary_names = _binary_names[::(-1)]
  if (x12path is None):
   x12path = os.getenv('X12PATH', '')
  if (not x12path):
   x12path = os.getenv('X13PATH', '')
 elif (x12path is None):
  x12path = os.getenv('X13PATH', '')
  if (not x12path):
   x12path = os.getenv('X12PATH', '')
 for binary in _binary_names:
  x12 = os.path.join(x12path, binary)
  try:
   subprocess.check_call(x12, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
   return x12
  except OSError:
   pass
 else:
  return False

def _find_x12 ( x12path = None , prefer_x13 = True ) : global _binary_names if ( ( x12path is not None ) and x12path . endswith ( _binary_names ) ) : x12path = os . path . dirname ( x12path ) if ( not prefer_x13 ) : _binary_names = _binary_names [ : : ( - 1 ) ] if ( x12path is None ) : x12path = os . getenv ( 'X12PATH' , '' ) if ( not x12path ) : x12path = os . getenv ( 'X13PATH' , '' ) elif ( x12path is None ) : x12path = os . getenv ( 'X13PATH' , '' ) if ( not x12path ) : x12path = os . getenv ( 'X12PATH' , '' ) for binary in _binary_names : x12 = os . path . join ( x12path , binary ) try : subprocess . check_call ( x12 , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) return x12 except OSError : pass else : return False
if x12path is not given .