code: def sporco_cupy_patch_module(name, attrib=None):
      
  
      # Patched module name is constructed from source module name
      # by replacing 'sporco.' with 'sporco.cupy.'
      pname = re.sub('^sporco.', 'sporco.cupy.', name)
      # Attribute dict always maps cupy module to 'np' attribute in
      # patched module
      if attrib is None:
          attrib = {}
      attrib.update({'np': cp})
      # Create patched module
      mod = patch_module(name, pname, pfile='patched', attrib=attrib)
      mod.__spec__.has_location = False
      return mod
docs: Create a copy of the named sporco module, patch it to replace
      numpy with cupy, and register it in ``sys.modules``.
  
      Parameters
      ----------
      name : string
        Name of source module
      attrib : dict or None, optional (default None)
        Dict of attribute names and values to assign to patched module
  
      Returns
      -------
      mod : module
        Patched module