def parse_attribute(attr): try: category, attr = attr.split(':') except ValueError: raise ArgumentTypeError('should be in format <category>:<attribute>') return category, attr