def parse_gage(s):
    """Parse a streamgage key-value pair.

    Parse a streamgage key-value pair, separated by '='; that's the reverse of ShellArgs.
    On the command line (argparse) a declaration will typically look like::
        foo=hello or foo="hello world"

    :param s: str
    :rtype: tuple(key, value)
    """

    # Adapted from: https://gist.github.com/fralau/061a4f6c13251367ef1d9a9a99fb3e8d
    items = s.split('=')
    key = items[0].strip()  # we remove blanks around keys, as is logical
    value = ''

    if len(items) > 1:
        # rejoin the rest:
        value = '='.join(items[1:])
    return key, value