code: def parse_dformat(dformat, check=True):
      
      if check and dformat not in ['dense', 'sparse']:
          raise IOError(
              "{} is a bad features format, please choose 'dense' or 'sparse'"
              .format(dformat))
      return dformat
docs: Return `dformat` or raise if it is not 'dense' or 'sparse