def imm_len_c(format, imm_t, imm_length):
      if format == "U_FORMAT" or format == "J_FORMAT":
        return imm_length == 20
      elif format == "I_FORMAT" or format == "S_FORMAT" or format == "B_FORMAT":
        if imm_t == "UIMM":
          return imm_length == 5
        else:
          return imm_length == 11
      else:
        return True