[IMP] models: improve _mapped_func(), and add parameter 'reverse' in sorted()