<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def login(self):
 """Login entrance."""

        username = click.prompt('Please enter your email or phone number')
        password = click.prompt('Please enter your password', hide_input=True)

        pattern = re.compile(r'^0\d{2,3}\d{7,8}$|^1[34578]\d{9}$')
        if pattern.match(username):  # use phone number to login
            url = 'https://music.163.com/weapi/login/cellphone'
            params = {
                'phone': username,
                'password': hashlib.md5(password.encode('utf-8')).hexdigest(),
                'rememberLogin': 'true'}
        else:  # use email to login
            url = 'https://music.163.com/weapi/login?csrf_token='
            params = {
                'username': username,
                'password': hashlib.md5(password.encode('utf-8')).hexdigest(),
                'rememberLogin': 'true'}

        try:
            result = self.post_request(url, params)
        except PostRequestIllegal:
            click.echo('Password Error!')
            sys.exit(1)
        self.session.cookies.save()
        uid = result['account']['id']
        with open(person_info_path, 'w') as person_info:
            person_info.write(str(uid))