code: def implied_vol(self, value, precision=1.0e-5, iters=100):
          
  
          vol = np.sqrt(2.0 * np.pi / self.T) * (value / self.S0)
          for _ in itertools.repeat(None, iters):  # Faster than range
              opt = BSM(
                  S0=self.S0,
                  K=self.K,
                  T=self.T,
                  r=self.r,
                  sigma=vol,
                  kind=self.kind,
              )
              diff = value - opt.value()
              if abs(diff) < precision:
                  return vol
              vol = vol + diff / opt.vega()
          return vol
docs: Get implied vol at the specified price using an iterative approach.
  
          There is no closed-form inverse of BSM-value as a function of sigma,
          so start at an anchoring volatility level from Brenner & Subrahmanyam
          (1988) and work iteratively from there.
  
          Resources
          ---------
          Brenner & Subrahmanyan, A Simple Formula to Compute the Implied
              Standard Deviation, 1988.