code: def __parse_affiliations_yml(self, affiliations):
          
  
          enrollments = []
  
          for aff in affiliations:
              name = self.__encode(aff['organization'])
              if not name:
                  error = "Empty organization name"
                  msg = self.GRIMOIRELAB_INVALID_FORMAT % {'error': error}
                  raise InvalidFormatError(cause=msg)
              elif name.lower() == 'unknown':
                  continue
  
              # we trust the Organization name included in the identities file
              org = Organization(name=name)
  
              if org is None:
                  continue
  
              if 'start' in aff:
                  start_date = self.__force_datetime(aff['start'])
              else:
                  start_date = MIN_PERIOD_DATE
  
              if 'end' in aff:
                  end_date = self.__force_datetime(aff['end'])
              else:
                  end_date = MAX_PERIOD_DATE
  
              enrollment = Enrollment(start=start_date, end=end_date,
                                      organization=org)
              enrollments.append(enrollment)
  
          self.__validate_enrollment_periods(enrollments)
  
          return enrollments
docs: Parse identity's affiliations from a yaml dict.