from typing import OrderedDict


def parse_info(soup):
    """Parse rent and detail descriptions from soup

    Arguments:
        soup: the soup object to parse from

    Returns:
        information (dict): parsed information
    """

    info = OrderedDict()

    infoSection = soup.select("div.detailInfo.clearfix")[0]
    priceSec = infoSection.select("div.price.clearfix")[0]
    explainSec = infoSection.select("div.explain")[0]
    attrs = infoSection.select("ul.attr li")

    price = priceSec.i.getText().replace(u" ", "").replace("\xa0", "").replace(u" ", "")
    explain = explainSec.getText().replace(u" ", "").replace("\xa0", "")
    info[u"租金"] = u"{0} ({1})".format(price, explain)

    for attr in attrs:
        info.update(
            (
                tuple(
                    attr.getText().replace(u"&nbsp;", "").replace("\xa0", "").split(":")
                ),
            )
        )

    return info