def getCraftValue(preferenceName, preferences):
 for preference in preferences:
  if preference.name.startswith(preferenceName):
   return preference.value
 return None

def getCraftValue ( preferenceName , preferences ) : for preference in preferences : if preference . name . startswith ( preferenceName ) : return preference . value return None
get craft preferences value .