code: def check_string(value, min_length=None, max_length=None, pattern=None):
      
      if type(value) not in [str, unicode]:
          return False
  
      if min_length and len(value) < min_length:
          return False
  
      if max_length and len(value) > max_length:
          return False
  
      if pattern and not re.match(pattern, value):
          return False
  
      return True
docs: verify that a string has a particular size and conforms
      to a particular alphabet
  
      >>> check_string(1)
      False
      >>> check_string(None)
      False
      >>> check_string(True)
      False
      >>> check_string({})
      False
      >>> check_string([])
      False
      >>> check_string((1,2))
      False
      >>> check_string('abc')
      True
      >>> check_string('')
      True
      >>> check_string(u'')
      True
      >>> check_string('abc', min_length=0, max_length=3)
      True
      >>> check_string('abc', min_length=3, max_length=3)
      True
      >>> check_string('abc', min_length=4, max_length=5)
      False
      >>> check_string('abc', min_length=0, max_length=2)
      False
      >>> check_string('abc', pattern='^abc$')
      True
      >>> check_string('abc', pattern='^abd$')
      False