def is_url_valid(self, url=None, return_base=False, return_formatted=False):
<EOL>initial_base = None<EOL>if url:<EOL><INDENT>to_test = url<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>if to_test.startswith("<STR_LIT:http>"):<EOL><INDENT>try:<EOL><INDENT>regex = r"<STR_LIT>"<EOL>initial_base = base = Regex(<EOL>to_test, regex, return_data=True, rematch=True<EOL>).match()[<NUM_LIT:2>]<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>base = domain2idna(base)<EOL><DEDENT>domain_status = self.is_domain_valid(base)<EOL>ip_status = self.is_ip_valid(base)<EOL>if domain_status or ip_status:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"] and return_formatted:<EOL><INDENT>return Regex(<EOL>to_test,<EOL>initial_base,<EOL>escape=True,<EOL>return_data=True,<EOL>replace_with=base,<EOL>occurences=<NUM_LIT:1>,<EOL>).replace()<EOL><DEDENT>if return_formatted:<EOL><INDENT>return to_test<EOL><DEDENT>if return_base:<EOL><INDENT>return base<EOL><DEDENT>return True<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if return_formatted:<EOL><INDENT>return to_test<EOL><DEDENT>return False<EOL>
Check if the given URL is valid.

:param url: The url to validate.
:type url: str

:param return_base:
    Allow us the return of the url base (if URL formatted correctly).
:type return_formatted: bool

:param return_formatted:
    Allow us to get the URL converted to IDNA if the conversion
    is activated.
:type return_formatted: bool


:return: The validity of the URL or its base.
:rtype: bool|str