<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _clean_required_args(self, url, redirect_uri, client_type):
 """ Validate and clean the command's arguments. Arguments: url (str):
 Client's application URL. redirect_uri (str):
 Client application's OAuth2 callback URI. client_type (str):
 Client's type, indicating whether the Client application is capable of maintaining the confidentiality of its credentials (e.g., running on a secure server) or is incapable of doing so (e.g., running in a browser). Raises: CommandError, if the URLs provided are invalid, or if the client type provided is invalid. """

        # Validate URLs
        for url_to_validate in (url, redirect_uri):
            try:
                URLValidator()(url_to_validate)
            except ValidationError:
                raise CommandError("URLs provided are invalid. Please provide valid application and redirect URLs.")

        # Validate and map client type to the appropriate django-oauth2-provider constant
        client_type = client_type.lower()
        client_type = {
            'confidential': CONFIDENTIAL,
            'public': PUBLIC
        }.get(client_type)

        if client_type is None:
            raise CommandError("Client type provided is invalid. Please use one of 'confidential' or 'public'.")

        self.fields = {  # pylint: disable=attribute-defined-outside-init
            'url': url,
            'redirect_uri': redirect_uri,
            'client_type': client_type,
        }