def is_pubkey(p: str) ->bool:
    """
    determines if a string can be interpreted as btc hex formatted pubkey
    """
    prefix = p[0:2]
    try:
        bytes.fromhex(p)
    except ValueError:
        return False
    if len(p) == 66:
        return prefix in ['02', '03']
    if len(p) == 130:
        return prefix == '04'
    return False
