r'''
    Helper function to properly format the path to the binary for the service
    Must be wrapped in double quotes to account for paths that have spaces. For
    example:

    ``"C:\Program Files\Path\to\bin.exe"``

    Args:
        cmd (str): Full path to the binary

    Returns:
        str: Properly quoted path to the binary

def _cmd_quote(cmd):
    r'''
    Helper function to properly format the path to the binary for the service
    Must be wrapped in double quotes to account for paths that have spaces. For
    example:

    ``"C:\Program Files\Path\to\bin.exe"``

    Args:
        cmd (str): Full path to the binary

    Returns:
        str: Properly quoted path to the binary
    '''
    # Remove all single and double quotes from the beginning and the end
    pattern = re.compile('^(\\"|\').*|.*(\\"|\')$')
    while pattern.match(cmd) is not None:
        cmd = cmd.strip('"').strip('\'')
    # Ensure the path to the binary is wrapped in double quotes to account for
    # spaces in the path
    cmd = '"{0}"'.format(cmd)
    return cmd