def parse_bip32_path(path):
    """Takes bip32 path, "m/0'/2H" or "m/0H/1/2H/2/1000000000.pub", returns list of ints """
    path = path.lstrip('m/').rstrip('.pub')
    if not path:
        return []
    patharr = []
    for v in path.split('/'):
        if not v:
            continue
        elif v[-1] in "'H":
            v = int(v[:-1]) | 2147483648
        else:
            v = int(v) & 2147483647
        patharr.append(v)
    return patharr
