def from_json(cls, key, scopes, subject=None):
        """Alternate constructor intended for using JSON format of private key.

        Args:
            key (dict) - Parsed JSON with service account credentials.
            scopes (Union[str, collections.Iterable[str]]) -
                List of permissions that the application requests.
            subject (str) - The email address of the user for which
                the application is requesting delegated access.

        Returns:
            ServiceAccount
        """
        credentials_type = key['type']
        if credentials_type != 'service_account':
            raise ValueError('key: expected type service_account '
                             '(got %s)' % credentials_type)
        email = key['client_email']
        key = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM,
                                             key['private_key'])

        return cls(key=key, email=email, scopes=scopes, subject=subject)
Alternate constructor intended for using JSON format of private key.

        Args:
            key (dict) - Parsed JSON with service account credentials.
            scopes (Union[str, collections.Iterable[str]]) -
                List of permissions that the application requests.
            subject (str) - The email address of the user for which
                the application is requesting delegated access.

        Returns:
            ServiceAccount