<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _AsMessageList(msg):
 """Convert the provided list-as-JsonValue to a list."""

    # This really needs to live in extra_types, but extra_types needs
    # to import this file to be able to register codecs.
    # TODO(craigcitro): Split out a codecs module and fix this ugly
    # import.
    from apitools.base.py import extra_types

    def _IsRepeatedJsonValue(msg):
        """Return True if msg is a repeated value as a JsonValue."""
        if isinstance(msg, extra_types.JsonArray):
            return True
        if isinstance(msg, extra_types.JsonValue) and msg.array_value:
            return True
        return False

    if not _IsRepeatedJsonValue(msg):
        raise ValueError('invalid argument to _AsMessageList')
    if isinstance(msg, extra_types.JsonValue):
        msg = msg.array_value
    if isinstance(msg, extra_types.JsonArray):
        msg = msg.entries
    return msg