def extract_instance_id(state_error):
    "Extract an instance id from an error"
    instance_id = None
    match = RE_ERROR_INSTANCE_ID.search(str(state_error))
    if match:
        instance_id = match.groupdict().get('instance_id')
    if match is None or instance_id is None:
        raise ValueError("Could not extract instance id from error: %s" % state_error)
    return instance_id
def extract_instance_id ( state_error ) : instance_id = None match = RE_ERROR_INSTANCE_ID . search ( str ( state_error ) ) if match : instance_id = match . groupdict ( ) . get ( 'instance_id' ) if match is None or instance_id is None : raise ValueError ( "Could not extract instance id from error: %s" % state_error ) return instance_id
Extract an instance id from an error