def METHOD_NAME(self, model):
    device = self.get_value_from_config('device') or 'cpu'
    device_match = re.match(DEVICE_REGEX, device.lower())
    if not device_match:
        raise ConfigError('unknown device: {}'.format(device))
    self.device = device_match.group('device')
    beckend_rep = backend.prepare(model=str(model), device=self.device.upper())
    return beckend_rep._session  # pylint: disable=W0212