code: def _legacy_private_key_pkcs8_to_pkcs1(pkcs8_key):
      
      # Only allow this processing if the prefix matches
      # AND the following byte indicates an ASN1 sequence,
      # as we would expect with the legacy encoding.
      if not pkcs8_key.startswith(LEGACY_INVALID_PKCS8_RSA_HEADER + ASN1_SEQUENCE_ID):
          raise ValueError("Invalid private key encoding")
  
      return pkcs8_key[len(LEGACY_INVALID_PKCS8_RSA_HEADER):]
docs: Legacy RSA private key PKCS8-to-PKCS1 conversion.
  
      .. warning::
  
          This is incorrect parsing and only works because the legacy PKCS1-to-PKCS8
          encoding was also incorrect.