def to_dict(block,
            keys=['hash', 'start', 'end', 'blockSize', 'version', 'prevHash',
                  'merkleRootHash', 'time', 'timestamp', 'nBits', 'nonce',
                  'nTransactions']):
    """
    Return block attributes as dict

    Similar to block.__dict__ but gets properties not just attributes.
    """

    # Create output dict
    bd = {}
    for k in keys:
        # Add each attribute with attribute name as key
        bd[k] = getattr(block, k)

    return bd