def bits_to_target(bits):
    """ Decodes the full target from a compact representation.
    See: https://bitcoin.org/en/developer-reference#target-nbits

    Args:
        bits (int): Compact target (32 bits)

    Returns:
        target (Bignum): Full 256-bit target
    """
    shift = bits >> 24
    target = (bits & 0xffffff) * (1 << (8 * (shift - 3)))
    return target