def test_for(item, min_version=None, callback=extract_version):
 try:
  check = import_item(item)
 except (ImportError, RuntimeError):
  return False
 else:
  if min_version:
   if callback:
    check = callback(check)
   return (check >= min_version)
  else:
   return True

def test_for ( item , min_version = None , callback = extract_version ) : try : check = import_item ( item ) except ( ImportError , RuntimeError ) : return False else : if min_version : if callback : check = callback ( check ) return ( check >= min_version ) else : return True
test to see if item is importable .