def METHOD_NAME(cls, typed_dict):
    items = []
    required_keys = list(getattr(typed_dict, '__required_keys__', []))
    optional_keys = list(getattr(typed_dict, '__optional_keys__', []))
    for key, value in typed_dict.__annotations__.items():
        typ = value.__name__ if isclass(value) else str(value)
        required = key in required_keys if required_keys or optional_keys else None
        items.append(TypedDictItem(key, typ, required))
    return cls(cls.TYPED_DICT, typed_dict.__name__, getdoc(typed_dict),
               accepts=(str, 'Mapping'), items=items)