pub fn encode_config(pem: &Pem, config: EncodeConfig) -> String {
    let line_ending = match config.line_ending {
        LineEnding::Crlf => "\r\n",
        LineEnding::Lf => "\n",
    };

    let mut output = String::new();

    let contents = if pem.contents.is_empty() {
        String::from("")
    } else {
        base64::encode(&pem.contents)
    };

    write!(output, "-----BEGIN {}-----{}", pem.tag, line_ending).unwrap();
    for c in contents.as_bytes().chunks(LINE_WRAP) {
        write!(output, "{}{}", str::from_utf8(c).unwrap(), line_ending).unwrap();
    }
    write!(output, "-----END {}-----{}", pem.tag, line_ending).unwrap();
    output
}
Encode a PEM struct into a PEM-encoded data string with additional
configuration options

# Example
```rust
use pem::{Pem, encode_config, EncodeConfig, LineEnding};

let pem = Pem {
tag: String::from("FOO"),
contents: vec![1, 2, 3, 4],
};
encode_config(&pem, EncodeConfig { line_ending: LineEnding::Lf });
```
src/pem.rs