code: def load_pkcs12(source, password=None):
      
  
      if password is not None:
          if isinstance(password, str_cls):
              password = password.encode('utf-8')
          if not isinstance(password, byte_cls):
              raise TypeError(pretty_message(
                  '''
                  password must be a byte string, not %s
                  ''',
                  type_name(password)
              ))
  
      if isinstance(source, str_cls):
          with open(source, 'rb') as f:
              source = f.read()
  
      elif not isinstance(source, byte_cls):
          raise TypeError(pretty_message(
              '''
              source must be a byte string or a unicode string, not %s
              ''',
              type_name(source)
          ))
  
      key_info, cert_info, extra_certs_info = parse_pkcs12(source, password)
  
      key = None
      cert = None
  
      if key_info:
          key = _load_key(key_info, PrivateKey)
  
      if cert_info:
          cert = _load_key(cert_info.public_key, Certificate)
  
      extra_certs = [_load_key(info.public_key, Certificate) for info in extra_certs_info]
  
      return (key, cert, extra_certs)
docs: Loads a .p12 or .pfx file into a PrivateKey object and one or more
      Certificates objects
  
      :param source:
          A byte string of file contents or a unicode string filename
  
      :param password:
          A byte or unicode string to decrypt the PKCS12 file. Unicode strings
          will be encoded using UTF-8.
  
      :raises:
          ValueError - when any of the parameters contain an invalid value
          TypeError - when any of the parameters are of the wrong type
          oscrypto.errors.AsymmetricKeyError - when a contained key is incompatible with the OS crypto library
          OSError - when an error is returned by the OS crypto library
  
      :return:
          A three-element tuple containing (PrivateKey, Certificate, [Certificate, ...])