for every f in return value of the os.listdir function called with an argument command_dir, append f without 3 last elements to a list, only if f doesnt start with character '_' and doesnt ends with string '.py', return the resulting list.
return [ f [ : - 3 ] for f in os . listdir ( command_dir ) if not f . startswith ( '_' ) and f . endswith ( '.py' ) ]