<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _detect_database_platform(self):
 """ Detects and sets the database platform. Evaluates custom platform class and version in order to set the correct platform. :raises InvalidPlatformSpecified: if an invalid platform was specified for this connection. """

        version = self._get_database_platform_version()

        if version is not None:
            self._platform = self._create_database_platform_for_version(version)
        else:
            self._platform = self.get_dbal_platform()