from bs4 import BeautifulSoup


def get_categories_objects(categories_output):
    """
    Return categories id, title and description from a table from response HTML
    document as the dict object:
    {
    'category_id': {
            'title': 'some_title',
            'description': 'some_description'
        }
    }
    """
    categories = {}

    document = BeautifulSoup(categories_output, 'html.parser')
    table = document.find_all('table')[0]

    for row in table.find_all('tr'):
        columns = row.find_all('td')
        if columns:
            categories[columns[0].get_text().strip()] = {
                'title': columns[1].get_text().strip(),
                'description': columns[2].get_text().strip()
            }
    return categories