Write code to compress the given string.
Compress each consecutive run of the same character using run-length encoding. Return each character followed by its run length, including a count of 1 for characters that appear once. Preserve the order of all runs.
Function: compress_string(s) accepts a string and returns a string. The empty string returns an empty string.
Examples: "aaabbc" returns "a3b2c1"; "abcd" returns "a1b1c1d1".
Constraints: 0 <= len(s) <= 1000; s contains printable characters.
def compress_string(s):