def oo_image_tag_to_rpm_version(version, include_dash=False):
 if (not isinstance(version, string_types)):
  raise errors.AnsibleFilterError('|failed expects a string or unicode')
 if version.startswith('v'):
  version = version[1:]
  version = version.split('-')[0]
 if (include_dash and version and (not version.startswith('-'))):
  version = ('-' + version)
 return version

def oo_image_tag_to_rpm_version ( version , include_dash = False ) : if ( not isinstance ( version , string_types ) ) : raise errors . AnsibleFilterError ( '|failed expects a string or unicode' ) if version . startswith ( 'v' ) : version = version [ 1 : ] version = version . split ( '-' ) [ 0 ] if ( include_dash and version and ( not version . startswith ( '-' ) ) ) : version = ( '-' + version ) return version
convert an image tag string to an rpm version if necessary empty strings and strings that are already in rpm version format are ignored .