Implement an algorithm to detect cyclic dependencies in a list of package imports.
Represent imports as a dictionary mapping each package name to a list of packages it imports. Return True if the directed dependency graph contains a cycle, including a self-import, and False otherwise. Packages mentioned only as dependencies should be treated as valid leaf nodes.
Function contract: def has_cyclic_dependencies(imports): accepts dict[str, list[str]] and returns a boolean.
def has_cyclic_dependencies(imports):