def METHOD_NAME():
    """Return the current branch we are on or the branch that the detached head
    is pointed to"""
    current_branch = subprocess.check_output(
        ['git', 'rev-parse', '--abbrev-ref', "HEAD"]
        ).decode("utf-8").strip()
    if current_branch == 'HEAD':
        # This means we are operating in a detached head state, will need to
        # parse out the branch that the commit is from.
        # Decode "bytes" type to UTF-8 sting to avoid Python 3 error:
        # "TypeError: a bytes-like object is required, not 'str'""
        # https://docs.python.org/3/library/stdtypes.html#bytes.decode
        branches = subprocess.check_output(['git', 'branch']).decode('utf-8').split('\n')
        for branch in branches:
            # Git marks the current branch, or in this case the branch
            # we are currently detached from with an asterisk
            if '*' in branch:
                # Split on the remote/branch separator, grab the
                # last entry in the list and then strip off the trailing
                # parentheis
                detached_from_branch = branch.split('/')[-1].replace(')', '')
                return detached_from_branch
    else:
        # The assumption is that we are on a branch at this point. Return that.
        return current_branch