def ledger(
        self,
        account,
        count=None,
        representative=False,
        weight=False,
        pending=False,
        sorting=False,
    ):
        """
        Returns frontier, open block, change representative block, balance,
        last modified timestamp from local database & block count starting at
        **account** up to **count**

        .. enable_control required
        .. version 8.0 required

        :param account: Account to return blocks for
        :type account: str

        :param count: Max number of blocks to return
        :type count: int

        :param representative: If true, returns the representative as well
        :type representative: bool

        :param weight: If true, returns the voting weight as well
        :type weight: bool

        :param pending: If true, returns the pending amount as well
        :type pending: bool

        :param sorting: If true, sorts the response by balance
        :type sorting: bool

        :raises: :py:exc:`nano.rpc.RPCException`

        >>> rpc.ledger(
        ...     account="xrb_1111111111111111111111111111111111111111111111111111hifc8npp",
        ...     count=1
        ... )
        {
            "xrb_11119gbh8hb4hj1duf7fdtfyf5s75okzxdgupgpgm1bj78ex3kgy7frt3s9n": {
                "frontier": "E71AF3E9DD86BBD8B4620EFA63E065B34D358CFC091ACB4E103B965F95783321",
                "open_block": "643B77F1ECEFBDBE1CC909872964C1DBBE23A6149BD3CEF2B50B76044659B60F",
                "representative_block": "643B77F1ECEFBDBE1CC909872964C1DBBE23A6149BD3CEF2B50B76044659B60F",
                "balance": 0,
                "modified_timestamp": 1511476234,
                "block_count": 2
            }
        }

        """

        account = self._process_value(account, 'account')

        payload = {"account": account}

        if count is not None:
            payload['count'] = self._process_value(count, 'int')

        if sorting:
            payload['sorting'] = self._process_value(sorting, 'strbool')

        if representative:
            payload['representative'] = self._process_value(representative, 'strbool')

        if weight:
            payload['weight'] = self._process_value(weight, 'strbool')

        if pending:
            payload['pending'] = self._process_value(pending, 'strbool')

        resp = self.call('ledger', payload)
        accounts = resp.get('accounts') or {}

        int_keys = ('balance', 'modified_timestamp', 'block_count', 'weight', 'pending')
        for account, frontier in accounts.items():
            for key in int_keys:
                if key in frontier:
                    frontier[key] = int(frontier[key])

        return accounts