def _clean_filepath(self, filepath):
        """
        processes the filepath by checking if it is a directory or not
        and adding `.py` if not present.
        """
        if (os.path.isdir(filepath) and
                os.path.isfile(os.path.join(filepath, '__init__.py'))):

            filepath = os.path.join(filepath, '__init__.py')

        if (not filepath.endswith('.py') and
                os.path.isfile(filepath + '.py')):
            filepath += '.py'
        return filepath
processes the filepath by checking if it is a directory or not
        and adding `.py` if not present.