code: def pem_to_der(cert, return_multiple=True):
      
  
      # initialize the certificate array
      cert_list = []
  
      # If certificate is in DER then un-armour it
      if pem.detect(cert):
          for _, _, der_bytes in pem.unarmor(cert, multiple=True):
              cert_list.append(der_bytes)
      else:
          cert_list.append(cert)
  
      # return multiple if return_multiple is set else first element
      if return_multiple:
          return cert_list
      else:
          return cert_list.pop()
docs: Converts a given certificate or list to PEM format