code: def _get_subjectinfo(patient_dict):
      # attempt to parse out the birthdate, but if it doesn't
      # meet spec, then it will set to None
      birthdate = patient_dict.get("birthdate")
      if "/" in birthdate:
          try:
              birthdate = datetime.strptime(birthdate, "%m/%d/%y")
          except ValueError:
              birthdate = None
              print("Unable to process birthdate of %s " % birthdate)
      elif "-" in birthdate:
          try:
              birthdate = datetime.strptime(birthdate, "%d-%m-%y")
          except ValueError:
              birthdate = None
              print("Unable to process birthdate of %s " % birthdate)
  
      subject_info = {
          "first_name": patient_dict.get("first"),
          "middle_name": patient_dict.get("middle"),
          "last_name": patient_dict.get("last"),
          "sex": patient_dict.get("sex"),
          "hand": patient_dict.get("hand"),
          "his_id": patient_dict.get("id"),
          "birthday": birthdate,
      }
  
      # Recode sex values
      sex_dict = dict(
          m=FIFF.FIFFV_SUBJ_SEX_MALE,
          male=FIFF.FIFFV_SUBJ_SEX_MALE,
          f=FIFF.FIFFV_SUBJ_SEX_FEMALE,
          female=FIFF.FIFFV_SUBJ_SEX_FEMALE,
      )
      subject_info["sex"] = sex_dict.get(
          subject_info["sex"], FIFF.FIFFV_SUBJ_SEX_UNKNOWN
      )
  
      # Recode hand values
      hand_dict = dict(
          r=FIFF.FIFFV_SUBJ_HAND_RIGHT,
          right=FIFF.FIFFV_SUBJ_HAND_RIGHT,
          l=FIFF.FIFFV_SUBJ_HAND_LEFT,
          left=FIFF.FIFFV_SUBJ_HAND_LEFT,
          a=FIFF.FIFFV_SUBJ_HAND_AMBI,
          ambidextrous=FIFF.FIFFV_SUBJ_HAND_AMBI,
          ambi=FIFF.FIFFV_SUBJ_HAND_AMBI,
      )
      # no handedness is set when unknown
      try:
          subject_info["hand"] = hand_dict[subject_info["hand"]]
      except KeyError:
          subject_info.pop("hand")
  
      return subject_info
  
file_path: mne-python/mne/io/persyst/persyst.py
imports: import os
  import os.path
  from collections import OrderedDict
  from datetime import datetime, timezone
  import numpy
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import create_info
  from ..._fiff.utils import _mult_cal_one
  from ...annotations import Annotations
  from ...utils import _check_fname, fill_doc, logger, verbose, warn
  from ..base import BaseRaw
label_desc: Use image node_id 2 for calling a global function with example usage: _get_subjectinfo(patient_dict) and returns: subject_info