Adjust cls_parts variable check

Change the if statement for an empty class parts variable so that it steals the last item from package_parts. This way, package + '.' + cls will still give the full import instead of duplicating the class.