'Return the sha for a given filepath by recursively calling Trees API for each level of the path'

def get_sha(self, owner, repo, filepath, branch='master'):

    filepath = self._clean_path(filepath)
    sha = branch
    path_tokens = filepath.split('/')
    for token in path_tokens:
        tree = self.get_tree(owner, repo, sha, recursive=False)
        for elem in tree['tree']:
            if (elem['path'] == token):
                sha = elem['sha']
                break
        else:
            raise GithubClientException(('Could    not    find    sha    for:    %s/%s/%s/%s' % (owner, repo, branch, filepath)))
    return sha
