def METHOD_NAME(self):
    if self.livemode is None or self.type is None:
        try:
            self.type, self.livemode = get_api_key_details_by_prefix(self.secret)
        except InvalidStripeAPIKey as e:
            raise ValidationError(str(e))