Check if a ssh-key is created and imported in github.  Else, exit with
    return value 1 (die).

def git_ssh_or_die(username, key_dir='~/.ssh'):
    ''' Check if a ssh-key is created and imported in github.  Else, exit with
    return value 1 (die).
    '''
    key_dir_expanded = os.path.expanduser(key_dir)
    # ssh pub key dictionary
    pub_keys = []

    # check if ~/.ssh exists, if not die
    if not os.path.isdir(key_dir_expanded):
        print(red(flo('Could not open folder `{key_dir}`.  If you do not have '
                      'a public ssh key, create one and place it in '
                      '`~/.ssh/arbitrarykeyname.pub`.  Name your public key '
                      '`.pub` at the end and run this command again')))
        sys.exit(0)

    # loop through files in ~/.ssh and search for ssh public keys
    for name in os.listdir(key_dir_expanded):
        filename = os.path.join(key_dir_expanded, name)
        if re.search("\.pub$", filename):
            # filename ends with .pub
            try:
                with open(filename, 'r') as fh:
                    for line in fh.readlines():
                        # ssh public key if *.pub is not empty
                        pub_keys.append(line.split()[1])
            except (IOError, OSError):
                print(red(flo(
                    'Could not read {filename}. Still moving on ...')))

    if len(pub_keys) < 1:
        print(red('You do not have a ssh public key.  '
                  'Please create one first and import it into your github '
                  'account.  Then restart this command.'))
        sys.exit(2)

    # get github pub keys from user
    github_pub_keys = os.popen(flo(
        'curl -s https://github.com/{username}.keys')).read()
    if github_pub_keys:
        for line in github_pub_keys.splitlines():
            line = line.split()
            pub_keys.append(line[1])

    # check if matching keys are found
    if len(pub_keys) == len(set(pub_keys)):
        print(red('Could not find your public key at github.  '
                  'Please import your public key into github '
                  'and rerun this command.'))
        sys.exit(3)