code: def beta_fragility_heuristic(returns, factor_returns):
      """Estimate fragility to drops in beta.
  
          Parameters
          ----------
          returns : pd.Series or np.ndarray
              Daily returns of the strategy, noncumulative.
              - See full explanation in :func:`~empyrical.stats.cum_returns`.
          factor_returns : pd.Series or np.ndarray
               Daily noncumulative returns of the factor to which beta is
               computed. Usually a benchmark such as the market.
               - This is in the same style as returns.
  
          Returns
          -------
          float, np.nan
              The beta fragility of the strategy.
  
          Note
          ----
          A negative return value indicates potential losses
          could follow volatility in beta.
          The magnitude of the negative value indicates the size of
          the potential loss.
          seealso::
          `A New Heuristic Measure of Fragility and
      Tail Risks: Application to Stress Testing`
              https://www.imf.org/external/pubs/ft/wp/2012/wp12216.pdf
              An IMF Working Paper describing the heuristic
      """
      if len(returns) < 3 or len(factor_returns) < 3:
          return np.nan
  
      return beta_fragility_heuristic_aligned(
          *_aligned_series(returns, factor_returns)
      )
  
imports: from __future__ import division
  import math
  import pandas
  import numpy
  from math import pow
  from scipy import stats, optimize
  from six import iteritems
  from sys import float_info
  from .utils import nanmean, nanstd, nanmin, up, down, roll, rolling_window
  from .periods import ANNUALIZATION_FACTORS, APPROX_BDAYS_PER_YEAR
  from .periods import DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY
label_desc: Use image node_id 32 for calling a global function with example usage: beta_fragility_heuristic(returns, factor_returns) and returns: beta_fragility_heuristic_aligned, np