from typing import Dict


def remove_empty_objects(content: Dict) -> Dict:
    """Remove dictionary keys with empty values.

    Arguments
    ---------
    content
        OpenAPI document to be cleaned up.

    Returns
    -------
    OpenAPI document without empty properties.

    """
    if isinstance(content, list):
        for key, value in enumerate(content):
            ref_content = remove_empty_objects(value)
            if isinstance(ref_content, list) and not ref_content:
                del content[key]
            else:
                content[key] = ref_content
    if isinstance(content, dict):
        for key in list(content.keys()):
            if isinstance(content[key], dict) and not content[key]:
                del content[key]
            elif isinstance(content[key], list) and not content[key]:
                del content[key]
            # Security basic authorization should be empty naturally
            elif key == 'security':
                continue
            else:
                content[key] = remove_empty_objects(content[key])
    return content