code: def _create_binary_vectorized_roll_function(function):
      def binary_vectorized_roll(lhs, rhs, window, out=None, **kwargs):
          """
          Computes the {human_readable} measure over a rolling window.
  
          Parameters
          ----------
          lhs : array-like
              The first array to pass to the rolling {human_readable}.
          rhs : array-like
              The second array to pass to the rolling {human_readable}.
          window : int
              Size of the rolling window in terms of the periodicity of the data.
          out : array-like, optional
              Array to use as output buffer.
              If not passed, a new array will be created.
          **kwargs
              Forwarded to :func:`~empyrical.{name}`.
  
          Returns
          -------
          rolling_{name} : array-like
              The rolling {human_readable}.
          """
          allocated_output = out is None
  
          if window >= 1 and len(lhs) and len(rhs):
              out = function(
                  rolling_window(
                      _flatten(lhs), min(len(lhs), window)
                  ).T,
                  rolling_window(
                      _flatten(rhs), min(len(rhs), window)
                  ).T,
                  out=out,
                  **kwargs,
              )
          elif allocated_output:
              out = np.empty(0, dtype="float64")
          else:
              out[()] = np.nan
  
          if allocated_output:
              if out.ndim == 1 and isinstance(lhs, pd.Series):
                  out = pd.Series(out, index=lhs.index[-len(out) :])
              elif out.ndim == 2 and isinstance(lhs, pd.Series):
                  out = pd.DataFrame(out, index=lhs.index[-len(out) :])
          return out
  
      binary_vectorized_roll.__doc__ = (
          binary_vectorized_roll.__doc__.format(
              name=function.__name__,
              human_readable=function.__name__.replace("_", " "),
          )
      )
  
      return binary_vectorized_roll
  
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 2 for calling a global function with example usage: _create_binary_vectorized_roll_function(function) and returns: binary_vectorized_roll, out