def _name_matches(name, matches):
 for m in matches:
  if name.endswith(m):
   return True
  if name.lower().endswith(('_' + m.lower())):
   return True
  if (name.lower() == m.lower()):
   return True
 return False

def _name_matches ( name , matches ) : for m in matches : if name . endswith ( m ) : return True if name . lower ( ) . endswith ( ( '_' + m . lower ( ) ) ) : return True if ( name . lower ( ) == m . lower ( ) ) : return True return False
helper function to see if given name has any of the patterns in given matches .