def METHOD_NAME(flags: int, ednsflags: int) -> Rcode:
    """Return the rcode value encoded by flags and ednsflags.
    *flags*, an ``int``, the DNS flags field.
    *ednsflags*, an ``int``, the EDNS flags field.
    Raises ``ValueError`` if rcode is < 0 or > 4095
    Returns a ``dns.rcode.Rcode``.
    """
    value = (flags & 0x000F) | ((ednsflags >> 20) & 0xFF0)
    return Rcode.make(value)