code: def _get_library(gi, sample_info, config):
      
      galaxy_lib = sample_info.get("galaxy_library",
                                   config.get("galaxy_library"))
      role = sample_info.get("galaxy_role",
                             config.get("galaxy_role"))
      if galaxy_lib:
          return _get_library_from_name(gi, galaxy_lib, role, sample_info, create=True)
      elif config.get("private_libs") or config.get("lab_association") or config.get("researcher"):
          return _library_from_nglims(gi, sample_info, config)
      else:
          raise ValueError("No Galaxy library specified for sample: %s" %
                           sample_info["description"])
docs: Retrieve the appropriate data library for the current user.