code: def get_domain_literal(value):
      
      domain_literal = DomainLiteral()
      if value[0] in CFWS_LEADER:
          token, value = get_cfws(value)
          domain_literal.append(token)
      if not value:
          raise errors.HeaderParseError("expected domain-literal")
      if value[0] != '[':
          raise errors.HeaderParseError("expected '[' at start of domain-literal "
                  "but found '{}'".format(value))
      value = value[1:]
      if _check_for_early_dl_end(value, domain_literal):
          return domain_literal, value
      domain_literal.append(ValueTerminal('[', 'domain-literal-start'))
      if value[0] in WSP:
          token, value = get_fws(value)
          domain_literal.append(token)
      token, value = get_dtext(value)
      domain_literal.append(token)
      if _check_for_early_dl_end(value, domain_literal):
          return domain_literal, value
      if value[0] in WSP:
          token, value = get_fws(value)
          domain_literal.append(token)
      if _check_for_early_dl_end(value, domain_literal):
          return domain_literal, value
      if value[0] != ']':
          raise errors.HeaderParseError("expected ']' at end of domain-literal "
                  "but found '{}'".format(value))
      domain_literal.append(ValueTerminal(']', 'domain-literal-end'))
      value = value[1:]
      if value and value[0] in CFWS_LEADER:
          token, value = get_cfws(value)
          domain_literal.append(token)
      return domain_literal, value
docs: domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]