code: def displayformat(codes=[], fg=None, bg=None):
          
          if isinstance(codes, basestring):
              codes = [codes]
          else:
              codes = list(codes)
          for code in codes:
              if code not in Magic.DISPLAY.keys():
                  raise ValueError("'%s' not a valid display value" % code)
          for color in (fg, bg):
              if color != None:
                  if color not in Magic.COLORS.keys():
                      raise ValueError("'%s' not a valid color" % color)
          return [codes, fg, bg]
docs: Makes sure all arguments are valid