code: def make_regex(string):
      
      if string and string[0] in '+-':
          sign, name = string[0], string[1:]
          if not name or '+' in name or '-' in name:
              raise ValueError('inappropriate feature name: %r' % string)
  
          tmpl = r'([+]?%s)' if sign == '+' else r'(-%s)'
          return tmpl % name
  
      if not string or '+' in string or '-' in string:
          raise ValueError('inappropriate feature name: %r' % string)
  
      return r'(%s)' % string
docs: Regex string for optionally signed binary or privative feature.
  
      >>> [make_regex(s) for s in '+spam -spam spam'.split()]
      ['([+]?spam)', '(-spam)', '(spam)']
  
      >>> make_regex('+eggs-spam')
      Traceback (most recent call last):
          ...
      ValueError: inappropriate feature name: '+eggs-spam'
  
      >>> make_regex('')
      Traceback (most recent call last):
          ...
      ValueError: inappropriate feature name: ''