public function locate($classname, $basepath = null)
    {
        if (substr($classname, 0, 3) === 'Plg')
        {
            /*
             * Exception rule for Exception classes
             *
             * Transform class to lower case to always load the exception class from the /exception/ folder.
             */
            if ($pos = strpos($classname, 'Exception'))
            {
                $filename  = substr($classname, $pos + strlen('Exception'));
                $classname = str_replace($filename, ucfirst(strtolower($filename)), $classname);
            }

            $word  = strtolower(preg_replace('/(?<=\\w)([A-Z])/', ' \\1', $classname));
            $parts = explode(' ', $word);

            array_shift($parts);
            $package   = array_shift($parts);
            $namespace = ucfirst($package);

            if(count($parts)) {
                $file = array_pop($parts);
            } else {
                $file = $package;
            }

            //Switch basepath
            if(!$this->getNamespace($namespace)) {
                $basepath = $this->getNamespace('\\');
            } else {
                $basepath = $this->getNamespace($namespace);
            }

            $path = '';

            if (!empty($parts)) {
                $path = implode('/', $parts) . '/';
            }

            $result = $basepath.'/'.$package.'/'.$path . $file.'.php';

            if(!is_file($result)) {
                $result = $basepath.'/'.$package.'/'.$path . $file.'/'.$file.'.php';
            }

            return $result;
        }

        return false;

    }