def sign_python():
    """
    Sign python (MacOS)
    Signing your python interpreter using self-signed certificate is used to
    get rid of annoying firewall questions about whether to allow incoming
    connections to the interpreter that happen on each app restart. This only
    makes sense on Mac. In order to use this command you must first create
    a certificate to sign your code with. To do it:

      1. Open Keychain Access
      2. Choose: Keychain Access > Certificate Assistant > Create Certificate
      3. Important: Use your current username for certificate name (id -un)
      4. Select Certificate Type: Code Signing
      5. Select Type: Self Signed Root
      6. Check 'Let me override defaults' box
      7. Click Continue, and give it a serial number (maximum randomness)
      8. Accept defaults for the rest

    You will only need to do this once. After this is done you can use
    generated certificate to sign your Python in any project.
    """
    from subprocess import check_output
    from os import system

    echo(green('\nSign python:'))
    echo(green('-' * 40))

    # get python
    python = check_output(['which', 'python']).decode().replace('\n', '')
    echo('Interpreter: ' + yellow(python))

    # get certificate name
    username = check_output(['id', '-un']).decode().replace('\n', '')
    echo('Using certificate: ' + yellow(username) + '\n')

    # signing
    cert = '"{}"'.format(username)
    cmd = "codesign -s {cert} -f {python}".format(cert=cert, python=python)
    system(cmd)

    echo(green('\nDONE\n'))
Sign python (MacOS)
    Signing your python interpreter using self-signed certificate is used to
    get rid of annoying firewall questions about whether to allow incoming
    connections to the interpreter that happen on each app restart. This only
    makes sense on Mac. In order to use this command you must first create
    a certificate to sign your code with. To do it:

      1. Open Keychain Access
      2. Choose: Keychain Access > Certificate Assistant > Create Certificate
      3. Important: Use your current username for certificate name (id -un)
      4. Select Certificate Type: Code Signing
      5. Select Type: Self Signed Root
      6. Check 'Let me override defaults' box
      7. Click Continue, and give it a serial number (maximum randomness)
      8. Accept defaults for the rest

    You will only need to do this once. After this is done you can use
    generated certificate to sign your Python in any project.