docs: def get_datasets(dataset_ids,**kwargs):
      """
          Get a single dataset, by ID
      """
  
      user_id = int(kwargs.get('user_id'))
      datasets = []
      if len(dataset_ids) == 0:
          return []
      try:
          dataset_rs = db.DBSession.query(Dataset.id,
                  Dataset.type,
                  Dataset.unit_id,
                  Dataset.name,
                  Dataset.hidden,
                  Dataset.cr_date,
                  Dataset.created_by,
                  DatasetOwner.user_id,
                  null().label('metadata'),
                  case([(and_(Dataset.hidden=='Y', DatasetOwner.user_id is not None), None)],
                          else_=Dataset.value).label('value')).filter(
                  Dataset.id.in_(dataset_ids)).outerjoin(DatasetOwner,
                                      and_(DatasetOwner.dataset_id==Dataset.id,
                                      DatasetOwner.user_id==user_id)).all()
  
          #convert the value row into a string as it is returned as a binary
          for dataset_row in dataset_rs:
              dataset_dict = dataset_row._asdict()
  
              if dataset_row.value is not None:
                  dataset_dict['value'] = str(dataset_row.value)
  
              if dataset_row.hidden == 'N' or (dataset_row.hidden == 'Y' and dataset_row.user_id is not None):
                  metadata = db.DBSession.query(Metadata).filter(Metadata.dataset_id == dataset_row.id).all()
                  dataset_dict['metadata'] = metadata
              else:
                  dataset_dict['metadata'] = []
  
              datasets.append(namedtuple('Dataset', dataset_dict.keys())(**dataset_dict))
  
  
      except NoResultFound:
          raise ResourceNotFoundError("Datasets not found.")
  
      return datasets