code: def check_offset(offset, max_value=None):
      
      if type(offset) not in [int, long]:
          return False
  
      if offset < 0:
          return False
  
      if max_value and offset > max_value:
          return False
  
      return True
docs: Verify that an offset is valid
  
      >>> check_offset(0)
      True
      >>> check_offset(-1)
      False
      >>> check_offset(2, max_value=2)
      True
      >>> check_offset(0)
      True
      >>> check_offset(2, max_value=1)
      False
      >>> check_offset('abc')
      False