<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_names(self, pat):
 """pat a shell pattern. See fnmatch.fnmatchcase. Print the results to stdout."""


        for item in self.chnames.items():
            if fnmatch.fnmatchcase(item[1], pat):
                print item