def dict_to_css(css_dict, pretty=False):
    """Takes a dictionary and creates CSS from it
    :param css_dict: python dictionary containing css rules
    :param pretty: if css should be generated as pretty
    :return: css as string
    """
    seperator = '\n'
    tab = '\t'
    if not pretty:
        seperator = ''
        tab = ''

    css_rules = []
    for selector, rules in css_dict.items():
        tmp = selector + '{' + seperator
        tmp_rules = []
        if isinstance(rules, dict):
            for rule, value in rules.items():
                tmp_rules.append(tab + rule + ':' + value + ';')
        tmp += seperator.join(tmp_rules)
        tmp = tmp + '}'
        css_rules.append(tmp)

    return seperator.join(css_rules)