Pubkey inputs can be compressed or uncompressed, as long as
    they're valid keys and hex strings. Use the validatepubkey()
    function to validate them first. The compression of the input
    keys does not do anything or matter in any way. Only the
    outcompressed bool dictates the compression of the output.

def addpubs(p1,p2,outcompressed=True):
    '''
    Pubkey inputs can be compressed or uncompressed, as long as
    they're valid keys and hex strings. Use the validatepubkey()
    function to validate them first. The compression of the input
    keys does not do anything or matter in any way. Only the
    outcompressed bool dictates the compression of the output.
    '''

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