def version_diff(v1, v2):
 if ((v1 is None) or (v2 is None)):
  return None
 v1_parts = v1.split('.')
 v2_parts = v2.split('.')
 v1_parts += (['0'] * (len(v2_parts) - len(v1_parts)))
 v2_parts += (['0'] * (len(v1_parts) - len(v2_parts)))
 for (v1p, v2p) in zip(v1_parts, v2_parts):
  cur_diff = (int(v1p) - int(v2p))
  if cur_diff:
   return cur_diff
 return 0

def version_diff ( v1 , v2 ) : if ( ( v1 is None ) or ( v2 is None ) ) : return None v1_parts = v1 . split ( '.' ) v2_parts = v2 . split ( '.' ) v1_parts += ( [ '0' ] * ( len ( v2_parts ) - len ( v1_parts ) ) ) v2_parts += ( [ '0' ] * ( len ( v1_parts ) - len ( v2_parts ) ) ) for ( v1p , v2p ) in zip ( v1_parts , v2_parts ) : cur_diff = ( int ( v1p ) - int ( v2p ) ) if cur_diff : return cur_diff return 0
diff is the integer difference between the most leftward part of the versions that differ .