return from the input string the return code of the powershell command

def _parse_return_code_powershell(string):
    '''
    return from the input string the return code of the powershell command
    '''

    regex = re.search(r'ReturnValue\s*: (\d*)', string)
    if not regex:
        return (False, 'Could not parse PowerShell return code.')
    else:
        return int(regex.group(1))