def compare_roa(roa, origin, length):
    """Compare origin AS and prefix length against ROA."""
    if length > roa["maxLength"]:
        return False
    roa_origin = roa["asn"]
    if isinstance(roa_origin, int):
        roa_origin = f"AS{roa_origin}"
    if origin != roa_origin:
        return False
    return True