def trimAlphaNum(value):
 while (value and value[(-1)].isalnum()):
  value = value[:(-1)]
 while (value and value[0].isalnum()):
  value = value[1:]
 return value

def trimAlphaNum ( value ) : while ( value and value [ ( - 1 ) ] . isalnum ( ) ) : value = value [ : ( - 1 ) ] while ( value and value [ 0 ] . isalnum ( ) ) : value = value [ 1 : ] return value
trims alpha numeric characters from start and ending of a given value .