- return path.replace(' ', '_').replace(')', '_').replace('(', '_')
\ No newline at end of file
+ return replace(path, {' ': '_', ')': '_', '(': '_'})
+
+
+def compact(string):
+ """
+ Removes blanks, underscores, dashes and parentheses.
+
+ Parameters
+ ----------
+ string : str or unicode
+ String to compact.
+
+ Returns
+ -------
+ str or unicode
+ A compact version of that string.
+ """
+
+ return replace(string.lower(),
+ OrderedDict(((' ', '_'),
+ ('(', '_'),
+ (')', '_'),
+ ('.', '_'),
+ ('-', '_'),
+ ('___', '_'),
+ ('__', '_'),
+ ('_', ''))))
+
+
+def colorspace_prefixed_name(colorspace):
+ """
+ Returns given *OCIO* colorspace prefixed name with its family name.
+
+ Parameters
+ ----------
+ colorspace : Colorspace
+ Colorspace to prefix.
+
+ Returns
+ -------
+ str or unicode
+ Family prefixed *OCIO* colorspace name.
+ """
+ prefix = colorspace.family.replace('/', ' - ')
+
+ return '%s - %s' % (prefix, colorspace.name)
+
+
+def unpack_default(iterable, length=3, default=None):
+ """
+ Unpacks given iterable maintaining given length and filling missing
+ entries with given default.
+
+ Parameters
+ ----------
+ iterable : object
+ Iterable.
+ length : int
+ Iterable length.
+ default : object
+ Filling default object.
+
+ Returns
+ -------
+ iterable
+ """
+
+ return itertools.islice(itertools.chain(iter(iterable),
+ itertools.repeat(default)),
+ length)