def bin(value: int, bits: int = 0) -> str:
    """Similar to built-in function bin(),

    except negative values are represented in two's complement,
    and the leading bit always indicates the sign (0 = positive, 1 = negative).
    """

    length = value.bit_length()

    if value < 0:
        sign = 1

        value = ~value ^ ((1 << length) - 1)

    else:
        sign = 0

    digits = f"{value:0>{length}b}"

    return f"0b{sign} {digits:{sign}>{bits}}"