def determine_name(func):
    """
    Given a function, returns the name of the function.

    Ex::

        from random import choice
        determine_name(choice) # Returns 'choice'

    Args:
        func (callable): The callable

    Returns:
        str: Name string
    """
    if hasattr(func, "__name__"):
        return func.__name__
    elif hasattr(func, "__class__"):
        return func.__class__.__name__

    # This shouldn't be possible, but blow up if so.
    raise AttributeError("Provided callable '{}' has no name.".format(func))