code: def datetime_from_ldap(value):
      
      if not value:
          return None
      match = LDAP_DATETIME_RE.match(value)
      if not match:
          return None
      groups = match.groupdict()
      if groups['microsecond']:
          groups['microsecond'] = groups['microsecond'].ljust(6, '0')[:6]
      tzinfo = groups.pop('tzinfo')
      if tzinfo == 'Z':
          tzinfo = timezone.utc
      else:
          offset_mins = int(tzinfo[-2:]) if len(tzinfo) == 5 else 0
          offset = 60 * int(tzinfo[1:3]) + offset_mins
          if tzinfo[0] == '-':
              offset = - offset
          tzinfo = timezone.get_fixed_timezone(offset)
      kwargs = {k: int(v) for k, v in groups.items() if v is not None}
      kwargs['tzinfo'] = tzinfo
      return datetime.datetime(**kwargs)
docs: Convert a LDAP-style datetime to a Python aware object.
  
      See https://tools.ietf.org/html/rfc4517#section-3.3.13 for details.
  
      Args:
          value (str): the datetime to parse