Input pubkey must be hex string and valid pubkey.
    Input privkey must be 64-char hex string.

    Pubkey input can be compressed or uncompressed, as long as it's a
    valid key and a hex string. Use the validatepubkey() function to
    validate the public key first.  The compression of the input
    public key does not do anything or matter in any way.

def multiplypub(pub,priv,outcompressed=True):
    '''
    Input pubkey must be hex string and valid pubkey.
    Input privkey must be 64-char hex string.

    Pubkey input can be compressed or uncompressed, as long as it's a
    valid key and a hex string. Use the validatepubkey() function to
    validate the public key first.  The compression of the input
    public key does not do anything or matter in any way.
    '''

    if len(pub) == 66:
        pub = uncompress(pub)
    x, y = ecmultiply(int(pub[2:66],16),int(pub[66:],16),int(priv,16))
    x = dechex(x,32)
    y = dechex(y,32)
    o = '04' + x + y
    if outcompressed:
        return compress(o)
    else:
        return o