import shlex


def get_namespace(imap):
    """ Get the namespace and separator of the specified mail account

    Example:
        imap.namespace() returns:
            (<code>, [b'(("<namespace>" "<separator>")) NIL NIL'])

    Args:
        imap <imaplib.IMAP4_SSL>: the account to check

    Returns:
        (namespace <str>, separator <str>)
    """
    results = shlex.split(imap.namespace()[1][0].decode() \
        .replace('(','') \
        .replace(')','')
    )

    return (results[0], results[1])