<gh_stars>10-100
def flatten(dictionary):
    result = {}
    for key, value in dictionary.items():
        if isinstance(value, dict):
            if value:
                ret = flatten(value)
                for i in ret:
                    result[key + '/' + i] = ret[i]
            else:
                result[key] = ''
        else:
            result[key] = value
    return result


if __name__ == '__main__':  # pragma: no cover
    # These "asserts" using only for self-checking and not necessary for
    # auto-testing
    assert flatten({"key": "value"}) == {"key": "value"}, "Simple"
    assert flatten({"key": {"deeper": {"more": {"enough": "value"}}}}) == {
        "key/deeper/more/enough": "value"
    }, "Nested"
    assert flatten({"empty": {}}) == {"empty": ""}, "Empty value"
    assert flatten(
        {
            "name": {"first": "One", "last": "Drone"},
            "job": "scout",
            "recent": {},
            "additional": {"place": {"zone": "1", "cell": "2"}},
        }
    ) == {
        "name/first": "One",
        "name/last": "Drone",
        "job": "scout",
        "recent": "",
        "additional/place/zone": "1",
        "additional/place/cell": "2",
    }

def flatten(dictionary):
    result = {}
    for key, value in dictionary.items():
        if isinstance(value, dict):
            if value:
                ret = flatten(value)
                for i in ret:
                    result[key + '/' + i] = ret[i]
            else:
                result[key] = ''
        else:
            result[key] = value
    return result


if __name__ == '__main__':  # pragma: no cover
    # These "asserts" using only for self-checking and not necessary for
    # auto-testing
    assert flatten({"key": "value"}) == {"key": "value"}, "Simple"
    assert flatten({"key": {"deeper": {"more": {"enough": "value"}}}}) == {
        "key/deeper/more/enough": "value"
    }, "Nested"
    assert flatten({"empty": {}}) == {"empty": ""}, "Empty value"
    assert flatten(
        {
            "name": {"first": "One", "last": "Drone"},
            "job": "scout",
            "recent": {},
            "additional": {"place": {"zone": "1", "cell": "2"}},
        }
    ) == {
        "name/first": "One",
        "name/last": "Drone",
        "job": "scout",
        "recent": "",
        "additional/place/zone": "1",
        "additional/place/cell": "2",
    }
# pragma: no cover # These "asserts" using only for self-checking and not necessary for # auto-testing