<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invoke(self, dirname, filenames=set(), linter_configs=set()):
 """ Main entrypoint for all plugins. Returns results in the format of: {'filename': { 'line_number': [ 'error1', 'error2' ] } } """

        retval = defaultdict(lambda: defaultdict(list))
        if len(filenames):
            extensions = [e.lstrip('.') for e in self.get_file_extensions()]
            filenames = [f for f in filenames if f.split('.')[-1] in extensions]

            if not filenames:
                # There were a specified set of files, but none were the right
                # extension. Different from the else-case below.
                return {}

            to_find = ' -o '.join(['-samefile "%s"' % f for f in filenames])
        else:
            to_find = ' -o '.join(['-name "*%s"' % ext
                                   for ext in self.get_file_extensions()])

        cmd = 'find %s -path "*/%s" | xargs %s' % (
            dirname, to_find, self.get_command(
                dirname,
                linter_configs=linter_configs))
        result = self.executor(cmd)
        for line in result.split('\n'):
            output = self.process_line(dirname, line)
            if output is not None:
                filename, lineno, messages = output
                if filename.startswith(dirname):
                    filename = filename[len(dirname) + 1:]
                retval[filename][lineno].append(messages)
        return retval