'Return the complete path for `profile_name`.
@raise BaseFrameworkException: If no existing profile file is found this
exception is raised with the proper desc
message.
>>> p = profile()
>>> p.get_real_profile_path(\'OWASP_TOP10\', \'.\')
\'./profiles/OWASP_TOP10.pw3af\''

def get_real_profile_path(self, profile_name, workdir):

    if (not profile_name.endswith(self.EXTENSION)):
        profile_name += self.EXTENSION
    if os.path.exists(profile_name):
        return profile_name
    for profile_path in self.get_profile_paths(workdir):
        _path = os.path.join(profile_path, profile_name)
        if os.path.exists(_path):
            return _path
    for profile_path in self.get_profile_paths(workdir):
        for profile_file in os.listdir(profile_path):
            if (not profile_file.endswith(self.EXTENSION)):
                continue
            profile_path_file = os.path.join(profile_path, profile_file)
            with codecs.open(profile_path_file, 'rb', UTF8) as fp:
                config = ConfigParser.ConfigParser()
                try:
                    config.readfp(fp)
                except:
                    continue
                try:
                    name = config.get(self.PROFILE_SECTION, 'name')
                except:
                    continue
                else:
                    if (('%s%s' % (name, self.EXTENSION)) == profile_name):
                        return profile_path_file
    msg = 'The    profile    "%s"    wasn\'t    found.'
    raise BaseFrameworkException((msg % profile_name))
