from bs4 import BeautifulSoup


def get_sorted_id_from_soup(soup:BeautifulSoup):
    """
    Sorts unique and duplicated IDs in a document markup language document.

    Args:
        soup (BeautifulSoup): markup language as BeautifulSoup object
    Returns:
        unique, duplicate ({}): two lists for unique and duplicated IDs
    Modules: 
        bs4 (BeautifulSoup)
    """
    unique, dupe = [], []
    for tag in soup.find_all(attrs={'id':True}):
        id = tag.get('id')
        if id not in unique:
            unique.append(id)
        else:
            dupe.append(id)
    sorted = {'unique': unique, 'duplicate': dupe}
    return sorted