@staticmethod
def from_parent(parent_key, i):
    '\n        '
    if isinstance(parent_key, HDPrivateKey):
        return HDPrivateKey.from_parent(parent_key, i).public_key
    elif isinstance(parent_key, HDPublicKey):
        if (i & 2147483648):
            raise ValueError("Can't generate a hardened child key from a parent public key.")
        else:
            I = hmac.new(parent_key.chain_code, (parent_key.compressed_bytes + i.to_bytes(length=4, byteorder='big')), hashlib.sha512).digest()
            (Il, Ir) = (I[:32], I[32:])
            parse_Il = int.from_bytes(Il, 'big')
            if (parse_Il >= bitcoin_curve.n):
                return None
            temp_priv_key = PrivateKey(parse_Il)
            Ki = (temp_priv_key.public_key.point + parent_key._key.point)
            if Ki.infinity:
                return None
            child_depth = (parent_key.depth + 1)
            return HDPublicKey(x=Ki.x, y=Ki.y, chain_code=Ir, index=i, depth=child_depth, parent_fingerprint=parent_key.fingerprint)
    else:
        raise TypeError('parent_key must be either a HDPrivateKey or HDPublicKey object')
@staticmethod
def from_parent(parent_key, i):
    '\n        '
    if isinstance(parent_key, HDPrivateKey):
        return HDPrivateKey.from_parent(parent_key, i).public_key
    elif isinstance(parent_key, HDPublicKey):
        if (i & 2147483648):
            raise ValueError("Can't generate a hardened child key from a parent public key.")
        else:
            I = hmac.new(parent_key.chain_code, (parent_key.compressed_bytes + i.to_bytes(length=4, byteorder='big')), hashlib.sha512).digest()
            (Il, Ir) = (I[:32], I[32:])
            parse_Il = int.from_bytes(Il, 'big')
            if (parse_Il >= bitcoin_curve.n):
                return None
            temp_priv_key = PrivateKey(parse_Il)
            Ki = (temp_priv_key.public_key.point + parent_key._key.point)
            if Ki.infinity:
                return None
            child_depth = (parent_key.depth + 1)
            return HDPublicKey(x=Ki.x, y=Ki.y, chain_code=Ir, index=i, depth=child_depth, parent_fingerprint=parent_key.fingerprint)
    else:
        raise TypeError('parent_key must be either a HDPrivateKey or HDPublicKey object')