<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def erase_devices(self, drives):
 """Perform Erase on all the drives in the controller. This method erases all the hdd and ssd drives in the controller by overwriting the drives with patterns for hdd and erasing storage blocks for ssd drives. The drives would be unavailable until successful completion or failure of erase operation. If the sanitize erase is not supported on any disk it will try to populate zeros on disk drives. :param drives: A list of drive objects in the controller. :raises: HPSSAOperationError, if sanitize erase is not supported. """

        for drive in drives:
            pattern = 'overwrite' if (
                drive.disk_type == constants.DISK_TYPE_HDD) else 'block'
            cmd_args = self._get_erase_command(
                drive.id, 'erasepattern=%s' % pattern)
            stdout = self.execute_cmd(*cmd_args)
            LOG.debug("Sanitize disk erase invoked with erase pattern as "
                      "'%(pattern)s' on disk type: %(disk_type)s."
                      % {'pattern': pattern, 'disk_type': drive.disk_type})

            if "not supported" in str(stdout):
                new_pattern = 'zero'
                cmd_args = self._get_erase_command(drive.id,
                                                   'erasepattern=zero')
                self.execute_cmd(*cmd_args)
                LOG.debug("Sanitize disk erase invoked with erase pattern as "
                          "'%(pattern)s' is not supported on disk type: "
                          "%(disk_type)s. Now its invoked with erase pattern "
                          "as %(new_pattern)s."
                          % {'pattern': pattern, 'disk_type': drive.disk_type,
                             'new_pattern': new_pattern})