# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Created by: Pavlos Parissis <pavlos.parissis@gmail.com>
#
import re
from operator import attrgetter


def sorted_nicely(l):
    """Sort the given iterable in the way that humans expect."""
    convert = lambda text: int(text) if text.isdigit() else text
    # The element is an object for which I need to use its name as key value
    g = attrgetter('name')
    alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', g(key))]

    return sorted(l, key=alphanum_key)

# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Created by: Pavlos Parissis <pavlos.parissis@gmail.com>
#
import re
from operator import attrgetter


def get_arg_option(args):
    for key, value in args.items():
        if key.startswith('--') and isinstance(value, bool) and value:
            return key.replace('-', '')


def sorted_nicely(l):
    """Sort the given iterable in the way that humans expect."""
    convert = lambda text: int(text) if text.isdigit() else text
    # The element is an object for which I need to use its name as key value
    g = attrgetter('name')
    alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', g(key))]

    return sorted(l, key=alphanum_key)

add a helper function to parse arguments