def parse_keyids(key):
    """Return parsed keyid string(s) or tuple of."""
    if isinstance(key, str):
        return key
    elif isinstance(key, (tuple, list)):
        return tuple(parse_keyids(keyid) for keyid in key)
    return getattr(key, "keyid")