from typing import Dict
from typing import Optional


def encode(metadata: Dict) -> Optional[str]:
    """Dump dictionary into the following form

        Package: A3
        Version: 1.0.0
        Depends: R (>= 2.15.0), xtable, pbapply
        Suggests: randomForest, e1071
        License: GPL (>= 2)
        MD5sum: 027ebdd8affce8f0effaecfcd5f5ade2
        NeedsCompilation: no

    Args:
        metadata (Dict): Converts metadata dictionary to deb format

    Returns:
        (Optional[str]): package record as deb format
    """
    return "\n".join([f"{key}: {value}" for key, value in metadata.items()])